From e4121968b0d6e993ef56e0bea78db44b311a802b Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 18 Mar 2021 07:27:37 -0700 Subject: [PATCH] Rebuilt lib --- dist/minimal-slp-wallet.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/minimal-slp-wallet.min.js b/dist/minimal-slp-wallet.min.js index 129bc12..9f7f821 100644 --- a/dist/minimal-slp-wallet.min.js +++ b/dist/minimal-slp-wallet.min.js @@ -1 +1 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SlpWallet=t()}}((function(){for(var define,module,exports,createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$cryptoBrowserify_469=createModuleFactory((function(t,e){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=_$browser_558,e.createHash=e.Hash=_$browser_465,e.createHmac=e.Hmac=_$browser_467;var r=Object.keys(_$algos_438),i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);e.getHashes=function(){return i},e.pbkdf2=_$browser_543.pbkdf2,e.pbkdf2Sync=_$browser_543.pbkdf2Sync,e.Cipher=_$browser_433.Cipher,e.createCipher=_$browser_433.createCipher,e.Cipheriv=_$browser_433.Cipheriv,e.createCipheriv=_$browser_433.createCipheriv,e.Decipher=_$browser_433.Decipher,e.createDecipher=_$browser_433.createDecipher,e.Decipheriv=_$browser_433.Decipheriv,e.createDecipheriv=_$browser_433.createDecipheriv,e.getCiphers=_$browser_433.getCiphers,e.listCiphers=_$browser_433.listCiphers,e.DiffieHellmanGroup=_$browser_476.DiffieHellmanGroup,e.createDiffieHellmanGroup=_$browser_476.createDiffieHellmanGroup,e.getDiffieHellman=_$browser_476.getDiffieHellman,e.createDiffieHellman=_$browser_476.createDiffieHellman,e.DiffieHellman=_$browser_476.DiffieHellman,e.createSign=_$browser_441.createSign,e.Sign=_$browser_441.Sign,e.createVerify=_$browser_441.createVerify,e.Verify=_$browser_441.Verify,e.createECDH=_$browser_463,e.publicEncrypt=_$browser_551.publicEncrypt,e.privateEncrypt=_$browser_551.privateEncrypt,e.publicDecrypt=_$browser_551.publicDecrypt,e.privateDecrypt=_$browser_551.privateDecrypt,e.randomFill=_$browser_559.randomFill,e.randomFillSync=_$browser_559.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),_$asn1_397=createModuleFactory((function(t,e){var r=e;r.bignum=_$bn_411,r.define=_$api_398({}).define,r.base=_$base_400({}),r.constants=_$constants_404({}),r.decoders=_$decoders_406({}),r.encoders=_$encoders_409({})})),_$encoders_409=createModuleFactory((function(t,e){var r=e;r.der=_$der_408({}),r.pem=_$pem_410({})})),_$pem_410=createModuleFactory((function(t,e){var r=_$der_408({});function i(t){r.call(this,t),this.enc="pem"}_$inherits_browser_530(i,r),t.exports=i,i.prototype.encode=function(t,e){for(var i=r.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"],o=0;o=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|o.tagClassByName[r||"universal"]<<6)}(t,e,i,this.reporter);if(n.length<128)return(a=new r(2))[0]=s,a[1]=n.length,this._createEncoderBuffer([a,n]);for(var u=1,h=n.length;h>=256;h>>=8)u++;(a=new r(2+u))[0]=s,a[1]=128|u,h=1+u;for(var f=n.length;f>0;h--,f>>=8)a[h]=255&f;return this._createEncoderBuffer([a,n])},s.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var i=new r(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;a>>=7)o++}var s=new r(o),u=s.length-1;for(n=t.length-1;n>=0;n--)for(a=t[n],s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a;return this._createEncoderBuffer(s)},s.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!r.isBuffer(t)){var i=t.toArray();!t.sign&&128&i[0]&&i.unshift(0),t=new r(i)}if(r.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new r(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var a=t;a>=256;a>>=8)n++;for(a=(o=new Array(n)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new r(o))},s.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},s.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:o.tag[r]}}function h(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?g(t,new b):S(t,h,e,!0);else if(h.ended)g(t,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?S(t,h,e,!1):A(t,h)):S(t,h,e,!1)}else i||(h.reading=!1,A(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(k,t))}function k(t){var e=t._readableState;n("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,R(t)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(B,t,r))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function T(t){n("readable nexttick read 0"),t.read(0)}function P(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),R(t),e.flowing&&!e.reading&&t.read(0)}function R(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function I(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 C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("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 N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=$(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?I(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&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){g(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?p:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",_),t.removeListener("finish",d),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",p),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,R(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),p(),t.removeListener("error",l),0===o(t,"error")&&g(t,e)}function _(){t.removeListener("finish",d),p()}function d(){n("onfinish"),t.removeListener("close",_),p()}function p(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",_),t.once("finish",d),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?E(this):o.reading||e.nextTick(T,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_457.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(x,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_457.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(x,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(P,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,B(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_452.destroy,M.prototype._undestroy=_$destroy_452.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$_stream_readable_504=createModuleFactory((function(t,e){(function(e,r){"use strict";var i;t.exports=w,w.ReadableState=y,_$events_498.EventEmitter;var n,o=function(t,e){return t.listeners(e).length},a=_$buffer_460({}).Buffer,s=r.Uint8Array||function(){},u=_$empty_415({});n=u&&u.debuglog?u.debuglog("stream"):function(){};var h,f,c,l=_$state_513.getHighWaterMark,_=_$errorsBrowser_501.codes,d=_.ERR_INVALID_ARG_TYPE,p=_.ERR_STREAM_PUSH_AFTER_EOF,m=_.ERR_METHOD_NOT_IMPLEMENTED,b=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;_$inherits_browser_530(w,_$streamBrowser_514);var g=_$destroy_509.errorOrDestroy,v=["error","close","destroy","pause","resume"];function y(t,e,r){i=i||_$Duplex_502({}),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=l(this,t,"readableHighWaterMark",r),this.buffer=new _$buffer_list_508,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=_$string_decoder_586({}).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function w(t){if(i=i||_$Duplex_502({}),!(this instanceof w))return new w(t);var e=this instanceof i;this._readableState=new y(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_514.call(this)}function M(t,e,r,i,o){n("readableAddChunk",e);var u,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(n("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?E(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,k(t)))}}(t,h);else if(o||(u=function(t,e){var r,i;return i=e,a.isBuffer(i)||i instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new d("chunk",["string","Buffer","Uint8Array"],e)),r}(h,e)),u)g(t,u);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?g(t,new b):S(t,h,e,!0);else if(h.ended)g(t,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?S(t,h,e,!1):A(t,h)):S(t,h,e,!1)}else i||(h.reading=!1,A(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(k,t))}function k(t){var e=t._readableState;n("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,R(t)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(B,t,r))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function T(t){n("readable nexttick read 0"),t.read(0)}function P(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),R(t),e.flowing&&!e.reading&&t.read(0)}function R(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function I(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 C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("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 N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=$(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?I(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&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){g(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?p:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",_),t.removeListener("finish",d),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",p),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,R(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),p(),t.removeListener("error",l),0===o(t,"error")&&g(t,e)}function _(){t.removeListener("finish",d),p()}function d(){n("onfinish"),t.removeListener("close",_),p()}function p(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",_),t.once("finish",d),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?E(this):o.reading||e.nextTick(T,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_514.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(x,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_514.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(x,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(P,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,B(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_509.destroy,M.prototype._undestroy=_$destroy_509.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$string_decoder_586=createModuleFactory((function(t,e){"use strict";var r=_$safeBuffer_576.Buffer,i=r.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 n(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&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=s,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=f,e=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.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,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(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 s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.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?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.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}})),_$Readable_563=createModuleFactory((function(t,e){(function(e,r){"use strict";var i;t.exports=_,_.ReadableState=l,_$events_498.EventEmitter;var n=function(t,e){return t.listeners(e).length},o=_$safeBuffer_569.Buffer,a=r.Uint8Array||function(){},s=Object.create(_$util_462);s.inherits=_$inherits_browser_530;var u,h=_$empty_415({}),f=void 0;f=h&&h.debuglog?h.debuglog("stream"):function(){},s.inherits(_,_$streamBrowser_568);var c=["error","close","destroy","pause","resume"];function l(t,e){t=t||{};var r=e instanceof(i=i||_$Duplex_561({}));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new _$BufferList_566,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(u||(u=_$string_decoder_570({}).StringDecoder),this.decoder=new u(t.encoding),this.encoding=t.encoding)}function _(t){if(i=i||_$Duplex_561({}),!(this instanceof _))return new _(t);this._readableState=new l(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_568.call(this)}function d(t,e,r,i,n){var s,u=t._readableState;return null===e?(u.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,b(t)}}(t,u)):(n||(s=function(t,e){var r,i;return i=e,o.isBuffer(i)||i instanceof a||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(u,e)),s?t.emit("error",s):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):p(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?p(t,u,e,!1):v(t,u)):p(t,u,e,!1))):i||(u.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(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;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_$processNextickArgs_549.nextTick(g,t):g(t))}function g(t){f("emit readable"),t.emit("readable"),S(t)}function v(t,e){e.readingMore||(e.readingMore=!0,_$processNextickArgs_549.nextTick(y,t,e))}function y(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 i;return to.length?o.length:t;if(a===o.length?n+=o:n+=o.slice(0,t),0==(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=o.allocUnsafe(t),i=e.head,n=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var a=i.data,s=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,s),0==(t-=s)){s===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(s));break}++n}return e.length-=n,r}(t,e),i}(t,e.buffer,e.decoder),r);var r}function E(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_$processNextickArgs_549.nextTick(k,e,t))}function k(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function A(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?E(this):b(this),null;if(0===(t=m(t,e))&&e.ended)return 0===e.length&&E(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?$(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&E(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,r){var i=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,f("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||t===e.stdout||t===e.stderr?m:s;function s(){f("onend"),t.end()}o.endEmitted?_$processNextickArgs_549.nextTick(a):i.once("end",a),t.on("unpipe",(function e(r,n){f("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",u),t.removeListener("error",_),t.removeListener("unpipe",e),i.removeListener("end",s),i.removeListener("end",m),i.removeListener("data",l),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,S(t))}}(i);t.on("drain",u);var h=!1,c=!1;function l(e){f("ondata"),c=!1,!1!==t.write(e)||c||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==A(o.pipes,t))&&!h&&(f("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,c=!0),i.pause())}function _(e){f("onerror",e),m(),t.removeListener("error",_),0===n(t,"error")&&t.emit("error",e)}function d(){t.removeListener("finish",p),m()}function p(){f("onfinish"),t.removeListener("close",d),m()}function m(){f("unpipe"),i.unpipe(t)}return i.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?_$isarray_532(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,_),t.once("close",d),t.once("finish",p),t.emit("pipe",i),o.flowing||(f("pipe resume"),i.resume()),t},_.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>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,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(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 s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.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?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.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}})),_$Duplex_561=createModuleFactory((function(t,e){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var i=Object.create(_$util_462);i.inherits=_$inherits_browser_530;var n=_$Readable_563({}),o=_$Writable_565({});i.inherits(h,n);for(var a=r(o.prototype),s=0;s-1?i:_$processNextickArgs_549.nextTick;d.WritableState=_;var s=Object.create(_$util_462);s.inherits=_$inherits_browser_530;var u,h={deprecate:_$browser_588},f=_$safeBuffer_569.Buffer,c=r.Uint8Array||function(){};function l(){}function _(t,e){o=o||_$Duplex_561({}),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,s=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:u,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===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(_$processNextickArgs_549.nextTick(n,i),_$processNextickArgs_549.nextTick(y,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),y(t,e))}(t,r,i,e,n);else{var o=g(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||b(t,r),i?a(m,t,r,o,n):m(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function d(t){if(o=o||_$Duplex_561({}),!(u.call(d,this)||this instanceof o))return new d(t);this._writableState=new _(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),_$streamBrowser_568.call(this)}function p(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function m(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),y(t,e)}function b(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,o=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,p(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(p(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function g(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function v(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),y(t,e)}))}function y(t,e){var r=g(e);return r&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,_$processNextickArgs_549.nextTick(v,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}s.inherits(d,_$streamBrowser_568),_.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(_.prototype,"buffer",{get: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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(d,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||this===d&&t&&t._writableState instanceof _}})):u=function(t){return t instanceof this},d.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},d.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,a=!n.objectMode&&(i=t,f.isBuffer(i)||i instanceof c);return a&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=l),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),_$processNextickArgs_549.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!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),_$processNextickArgs_549.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.pendingcb++,o=function(t,e,r,i,n,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=e.objectMode?1:i.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),d.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},d.prototype._writev=null,d.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,y(t,e),r&&(e.finished?_$processNextickArgs_549.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),d.prototype.destroy=_$destroy_567.destroy,d.prototype._undestroy=_$destroy_567.undestroy,d.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$main_587({}).setImmediate)})),_$main_587=createModuleFactory((function(t,e){(function(t,r){var i=_$browser_550.nextTick,n=(Function.prototype.apply,Array.prototype.slice),o={},a=0;function s(t,e){this._id=t,this._clearFn=e}s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(window,this._id)},e.setImmediate="function"==typeof t?t:function(t){var r=a++,s=!(arguments.length<2)&&n.call(arguments,1);return o[r]=!0,i((function(){o[r]&&(s?t.apply(null,s):t.call(null),e.clearImmediate(r))})),r},e.clearImmediate="function"==typeof r?r:function(t){delete o[t]}}).call(this,_$main_587({}).setImmediate,_$main_587({}).clearImmediate)})),_$_stream_readable_292=createModuleFactory((function(t,e){(function(e,r){"use strict";var i;t.exports=w,w.ReadableState=y,_$events_498.EventEmitter;var n,o=function(t,e){return t.listeners(e).length},a=_$buffer_460({}).Buffer,s=r.Uint8Array||function(){},u=_$empty_415({});n=u&&u.debuglog?u.debuglog("stream"):function(){};var h,f,c,l=_$state_301.getHighWaterMark,_=_$errorsBrowser_289.codes,d=_.ERR_INVALID_ARG_TYPE,p=_.ERR_STREAM_PUSH_AFTER_EOF,m=_.ERR_METHOD_NOT_IMPLEMENTED,b=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;_$inherits_browser_317(w,_$streamBrowser_302);var g=_$destroy_297.errorOrDestroy,v=["error","close","destroy","pause","resume"];function y(t,e,r){i=i||_$Duplex_290({}),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=l(this,t,"readableHighWaterMark",r),this.buffer=new _$buffer_list_296,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=_$string_decoder_370({}).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function w(t){if(i=i||_$Duplex_290({}),!(this instanceof w))return new w(t);var e=this instanceof i;this._readableState=new y(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_302.call(this)}function M(t,e,r,i,o){n("readableAddChunk",e);var u,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(n("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?E(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,k(t)))}}(t,h);else if(o||(u=function(t,e){var r,i;return i=e,a.isBuffer(i)||i instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new d("chunk",["string","Buffer","Uint8Array"],e)),r}(h,e)),u)g(t,u);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?g(t,new b):S(t,h,e,!0);else if(h.ended)g(t,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?S(t,h,e,!1):A(t,h)):S(t,h,e,!1)}else i||(h.reading=!1,A(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(k,t))}function k(t){var e=t._readableState;n("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,R(t)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(B,t,r))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function T(t){n("readable nexttick read 0"),t.read(0)}function P(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),R(t),e.flowing&&!e.reading&&t.read(0)}function R(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function I(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 C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("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 N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=$(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?I(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&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){g(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?p:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",_),t.removeListener("finish",d),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",p),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,R(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),p(),t.removeListener("error",l),0===o(t,"error")&&g(t,e)}function _(){t.removeListener("finish",d),p()}function d(){n("onfinish"),t.removeListener("close",_),p()}function p(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",_),t.once("finish",d),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?E(this):o.reading||e.nextTick(T,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_302.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(x,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_302.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(x,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(P,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a>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,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(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 s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.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?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.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}})),_$Duplex_290=createModuleFactory((function(t,e){(function(e){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=u;var i=_$_stream_readable_292({}),n=_$_stream_writable_294({});_$inherits_browser_317(u,i);for(var o=r(n.prototype),a=0;a-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,B(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_297.destroy,M.prototype._undestroy=_$destroy_297.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$empty_415=createModuleFactory((function(t,e){})),_$buffer_460=createModuleFactory((function(t,e){(function(t){"use strict";e.Buffer=t,e.SlowBuffer=function(e){return+e!=e&&(e=0),t.alloc(+e)},e.INSPECT_MAX_BYTES=50;function r(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return r.__proto__=t.prototype,r}function t(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 o(t)}return i(t,e,r)}function i(e,i,n){if("string"==typeof e)return function(e,i){if("string"==typeof i&&""!==i||(i="utf8"),!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i);var n=0|u(e,i),o=r(n),a=o.write(e,i);return a!==n&&(o=o.slice(0,a)),o}(e,i);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer))return function(e,r,i){if(r<0||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function u(e,r){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return I(e).length;default:if(o)return n?-1:R(e).length;r=(""+r).toLowerCase(),o=!0}}function h(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function f(e,r,i,n,o){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),N(i=+i)&&(i=o?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(o)return-1;i=e.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof r&&(r=t.from(r,n)),t.isBuffer(r))return 0===r.length?-1:c(e,r,i,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,i):Uint8Array.prototype.lastIndexOf.call(e,r,i):c(e,[r],i,n,o);throw new TypeError("val must be string, number or Buffer")}function c(t,e,r,i,n){var o,a=1,s=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;ln&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var a=0;a>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function g(t,e,r){return 0===e&&r===t.length?_$base64Js_412.fromByteArray(t):_$base64Js_412.fromByteArray(t.slice(e,r))}function v(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[n+1]))&&(u=(31&h)<<6|63&o)>127&&(f=u);break;case 3:o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(u=(15&h)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&h)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=c}return function(t){var e=t.length;if(e<=y)return String.fromCharCode.apply(String,t);for(var r="",i=0;ithis.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 S(this,e,r);case"utf8":case"utf-8":return v(this,e,r);case"ascii":return w(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},t.prototype.compare=function(e,r,i,n,o){if(O(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(r>>>=0),u=Math.min(a,s),h=this.slice(n,o),f=e.slice(r,i),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return l(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return d(this,t,e,r);case"latin1":case"binary":return p(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var y=4096;function w(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function k(e,r,i,n,o,a){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function A(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,i,n){return e=+e,r>>>=0,n||A(t,0,r,4),_$ieee754_529.write(t,e,r,i,23,4),r+4}function x(t,e,r,i,n){return e=+e,r>>>=0,n||A(t,0,r,8),_$ieee754_529.write(t,e,r,i,52,8),r+8}t.prototype.slice=function(e,r){var i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(r=void 0===r?i:~~r)<0?(r+=i)<0&&(r=0):r>i&&(r=i),r>>=0,e>>>=0,r||E(t,e,this.length);for(var i=this[t],n=1,o=0;++o>>=0,e>>>=0,r||E(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},t.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},t.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),_$ieee754_529.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),_$ieee754_529.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),_$ieee754_529.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),_$ieee754_529.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||k(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||k(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},t.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},t.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},t.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}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},t.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},t.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return x(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return x(this,t,e,!1,r)},t.prototype.copy=function(e,r,i,n){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r=0;--a)e[a+r]=this[a+i];else Uint8Array.prototype.set.call(e,this.subarray(i,n),r);return o},t.prototype.fill=function(e,r,i,n){if("string"==typeof e){if("string"==typeof r?(n=r,r=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!t.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e&&(e&=255);if(r<0||this.length>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(a=r;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=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 I(t){return _$base64Js_412.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function O(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this,_$buffer_460({}).Buffer)})),_$base64Js_412={toByteArray:function(t){var e,r,i=getLens(t),n=i[0],o=i[1],a=new Arr(function(t,e,r){return 3*(e+r)/4-r}(0,n,o)),s=0,u=o>0?n-4:n;for(r=0;r>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===o&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[s++]=255&e),1===o&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,a=r-i;oa?a:o+16383));return 1===i?(e=t[r-1],n.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],n.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),n.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var i,n,o=[],a=e;a>18&63]+lookup[n>>12&63]+lookup[n>>6&63]+lookup[63&n]);return o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_529={read:function(t,e,r,i,n){var o,a,s=8*n-i-1,u=(1<>1,f=-7,c=r?n-1:0,l=r?-1:1,_=t[e+c];for(c+=l,o=_&(1<<-f)-1,_>>=-f,f+=s;f>0;o=256*o+t[e+c],c+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=i;f>0;a=256*a+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return a?NaN:1/0*(_?-1:1);a+=Math.pow(2,i),o-=h}return(_?-1:1)*a*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var a,s,u,h=8*o-n-1,f=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,_=i?0:o-1,d=i?1:-1,p=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=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(e*u-1)*Math.pow(2,n),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[r+_]=255&s,_+=d,s/=256,n-=8);for(a=a<0;t[r+_]=255&a,_+=d,a/=256,h-=8);t[r+_-d]|=128*p}},_$safeBuffer_345={},buffer=_$buffer_460({}),Buffer=buffer.Buffer;function copyProps(t,e){for(var r in t)e[r]=t[r]}function SafeBuffer(t,e,r){return Buffer(t,e,r)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?_$safeBuffer_345=buffer:(copyProps(buffer,_$safeBuffer_345),_$safeBuffer_345.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(Buffer.prototype),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return Buffer(t,e,r)},SafeBuffer.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=Buffer(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return Buffer(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(t)};var __Buffer_187=_$safeBuffer_345.Buffer,_$bip66_187={check:function(t){if(t.length<8)return!1;if(t.length>72)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-2)return!1;if(2!==t[2])return!1;var e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},decode:function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");var e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");var r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},encode:function(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var n=__Buffer_187.allocUnsafe(6+r+i);return n[0]=48,n[1]=n.length-2,n[2]=2,n[3]=t.length,t.copy(n,4),n[4+r]=2,n[5+r]=e.length,e.copy(n,6+r),n}},_$index_38={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKDATASIG:186,OP_CHECKDATASIGVERIFY:187,OP_REVERSEBYTES:188,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};function encodingLength(t){return t<_$index_38.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}var _$pushdataBitcoin_97={encodingLength:encodingLength,encode:function(t,e,r){var i=encodingLength(e);return 1===i?t.writeUInt8(e,r):2===i?(t.writeUInt8(_$index_38.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===i?(t.writeUInt8(_$index_38.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(_$index_38.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),i},decode:function(t,e){var r,i,n=t.readUInt8(e);if(n<_$index_38.OP_PUSHDATA1)r=n,i=1;else if(n===_$index_38.OP_PUSHDATA1){if(e+2>t.length)return null;r=t.readUInt8(e+1),i=2}else if(n===_$index_38.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(n!==_$index_38.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:n,number:r,size:i}}},types={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 typeName in types.Null=types.Nil,types)types[typeName].toJSON=function(t){return t}.bind(null,typeName);var _$types_389=types,_$errors_386={};function getTypeName(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName(t){return _$types_389.Nil(t)?"":getTypeName(t.constructor)}function captureStackTrace(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function tfJSON(t){return _$types_389.Function(t)?t.toJSON?t.toJSON():getTypeName(t):_$types_389.Array(t)?"Array":t&&_$types_389.Object(t)?"Object":void 0!==t?t:""}function tfErrorString(t,e,r){var i=function(t){return _$types_389.Function(t)?"":_$types_389.String(t)?JSON.stringify(t):t&&_$types_389.Object(t)?"":t}(e);return"Expected "+tfJSON(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function TfTypeError(t,e,r){r=r||getValueTypeName(e),this.message=tfErrorString(t,e,r),captureStackTrace(this,TfTypeError),this.__type=t,this.__value=e,this.__valueTypeName=r}function TfPropertyTypeError(t,e,r,i,n){t?(n=n||getValueTypeName(i),this.message=function(t,e,r,i,n){var o='" of type ';return"key"===e&&(o='" with key type '),tfErrorString('property "'+tfJSON(r)+o+tfJSON(t),i,n)}(t,r,e,i,n)):this.message='Unexpected property "'+e+'"',captureStackTrace(this,TfTypeError),this.__label=r,this.__property=e,this.__type=t,this.__value=i,this.__valueTypeName=n}function isBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}TfTypeError.prototype=Object.create(Error.prototype),TfTypeError.prototype.constructor=TfTypeError,TfPropertyTypeError.prototype=Object.create(Error.prototype),TfPropertyTypeError.prototype.constructor=TfTypeError,_$errors_386={TfTypeError:TfTypeError,TfPropertyTypeError:TfPropertyTypeError,tfCustomError:function(t,e){return new TfTypeError(t,{},e)},tfSubError:function(t,e,r){return t instanceof TfPropertyTypeError?(e=e+"."+t.__property,t=new TfPropertyTypeError(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof TfTypeError&&(t=new TfPropertyTypeError(t.__type,e,r,t.__value,t.__valueTypeName)),captureStackTrace(t),t},tfJSON:tfJSON,getValueTypeName:getValueTypeName};var _$isBuffer_531=function(t){return null!=t&&(isBuffer(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isBuffer(t.slice(0,0))}(t)||!!t._isBuffer)},_$types_387={};(function(t){function e(e){return t.isBuffer(e)}function r(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function i(t,e){var r=t.toJSON();function i(i){if(!t(i))return!1;if(i.length===e)return!0;throw _$errors_386.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+i.length+")")}return i.toJSON=function(){return r},i}var n=i.bind(null,_$types_389.Array),o=i.bind(null,e),a=i.bind(null,r),s=i.bind(null,_$types_389.String),u=Math.pow(2,53)-1,h={ArrayN:n,Buffer:e,BufferN:o,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:r,HexN:a,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>=-u&&t<=u&&Math.floor(t)===t},Range:function(t,e,r){function i(i,n){return r(i,n)&&i>t&&i>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=u&&Math.floor(t)===t}};for(var f in h)h[f].toJSON=function(t){return t}.bind(null,f);_$types_387=h}).call(this,{isBuffer:_$isBuffer_531});var _$typeforce_388={},__tfJSON_388=_$errors_386.tfJSON,__TfTypeError_388=_$errors_386.TfTypeError,__TfPropertyTypeError_388=_$errors_386.TfPropertyTypeError,tfSubError=_$errors_386.tfSubError,__getValueTypeName_388=_$errors_386.getValueTypeName,TYPES={arrayOf:function(t,e){function r(r,i){return!!_$types_389.Array(r)&&!_$types_389.Nil(r)&&!(void 0!==e.minLength&&r.lengthe.maxLength)&&(void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return typeforce(t,e,i)}catch(n){throw tfSubError(n,r)}}))}return t=compile(t),e=e||{},r.toJSON=function(){var r="["+__tfJSON_388(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,i){return _$types_389.Nil(r)||e(r,i,t)}return e=compile(e),r.toJSON=function(){return"?"+__tfJSON_388(e)},r},map:function(t,e){function r(r,i){if(!_$types_389.Object(r))return!1;if(_$types_389.Nil(r))return!1;for(var n in r){try{e&&typeforce(e,n,i)}catch(a){throw tfSubError(a,n,"key")}try{var o=r[n];typeforce(t,o,i)}catch(a){throw tfSubError(a,n)}}return!0}return t=compile(t),e&&(e=compile(e)),r.toJSON=e?function(){return"{"+__tfJSON_388(e)+": "+__tfJSON_388(t)+"}"}:function(){return"{"+__tfJSON_388(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=compile(t[r]);function i(t,r){if(!_$types_389.Object(t))return!1;if(_$types_389.Nil(t))return!1;var i;try{for(i in e)typeforce(e[i],t[i],r)}catch(n){throw tfSubError(n,i)}if(r)for(i in t)if(!e[i])throw new __TfPropertyTypeError_388(void 0,i);return!0}return i.toJSON=function(){return __tfJSON_388(e)},i},anyOf:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return t.some((function(t){try{return typeforce(t,e,r)}catch(i){return!1}}))}return e.toJSON=function(){return t.map(__tfJSON_388).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return t.every((function(t){try{return typeforce(t,e,r)}catch(i){return!1}}))}return e.toJSON=function(){return t.map(__tfJSON_388).join(" & ")},e},quacksLike:function(t){function e(e){return t===__getValueTypeName_388(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return!_$types_389.Nil(e)&&!_$types_389.Nil(e.length)&&(!r||e.length===t.length)&&t.every((function(t,i){try{return typeforce(t,e[i],r)}catch(n){throw tfSubError(n,i)}}))}return e.toJSON=function(){return"("+t.map(__tfJSON_388).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function compile(t){if(_$types_389.String(t))return"?"===t[0]?TYPES.maybe(t.slice(1)):_$types_389[t]||TYPES.quacksLike(t);if(t&&_$types_389.Object(t)){if(_$types_389.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(t[0])}return TYPES.object(t)}return _$types_389.Function(t)?t:TYPES.value(t)}function typeforce(t,e,r,i){if(_$types_389.Function(t)){if(t(e,r))return!0;throw new __TfTypeError_388(i||t,e)}return typeforce(compile(t),e,r)}for(var __typeName_388 in TYPES.oneOf=TYPES.anyOf,_$types_389)typeforce[__typeName_388]=_$types_389[__typeName_388];for(__typeName_388 in TYPES)typeforce[__typeName_388]=TYPES[__typeName_388];for(__typeName_388 in _$types_387)typeforce[__typeName_388]=_$types_387[__typeName_388];typeforce.compile=compile,typeforce.TfTypeError=__TfTypeError_388,typeforce.TfPropertyTypeError=__TfPropertyTypeError_388,_$typeforce_388=typeforce;var UINT31_MAX=Math.pow(2,31)-1;function BIP32Path(t){return _$typeforce_388.String(t)&&t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}BIP32Path.toJSON=function(){return"BIP32 derivation path"};var SATOSHI_MAX=21e14,__BigInt_78=_$typeforce_388.quacksLike("BigInteger"),ECPoint=_$typeforce_388.quacksLike("Point"),ECSignature=_$typeforce_388.compile({r:__BigInt_78,s:__BigInt_78}),Network=_$typeforce_388.compile({messagePrefix:_$typeforce_388.oneOf(_$typeforce_388.Buffer,_$typeforce_388.String),bip32:{public:_$typeforce_388.UInt32,private:_$typeforce_388.UInt32},pubKeyHash:_$typeforce_388.UInt8,scriptHash:_$typeforce_388.UInt8,wif:_$typeforce_388.UInt8}),__types_78={BigInt:__BigInt_78,BIP32Path:BIP32Path,Buffer256bit:_$typeforce_388.BufferN(32),ECPoint:ECPoint,ECSignature:ECSignature,Hash160bit:_$typeforce_388.BufferN(20),Hash256bit:_$typeforce_388.BufferN(32),Network:Network,Satoshi:function(t){return _$typeforce_388.UInt53(t)&&t<=SATOSHI_MAX},UInt31:function(t){return _$typeforce_388.UInt32(t)&&t<=UINT31_MAX}};for(var __typeName_78 in _$typeforce_388)__types_78[__typeName_78]=_$typeforce_388[__typeName_78];var _$types_78=__types_78,map={};for(var op in _$index_38)map[_$index_38[op]]=op;var _$map_39=map,__Buffer_53=_$safeBuffer_345.Buffer,_$script_number_53={decode:function(t,e,r){e=e||4,r=void 0===r||r;var i=t.length;if(0===i)return 0;if(i>e)throw new TypeError("Script number overflow");if(r&&0==(127&t[i-1])&&(i<=1||0==(128&t[i-2])))throw new Error("Non-minimally encoded script number");if(5===i){var n=t.readUInt32LE(0),o=t.readUInt8(4);return 128&o?-(4294967296*(-129&o)+n):4294967296*o+n}for(var a=0,s=0;s2147483647?5:t>8388607?4:t>32767?3:t>127?2:t>0?1:0}(e),i=__Buffer_53.allocUnsafe(r),n=t<0,o=0;o>=8;return 128&i[r-1]?i.writeUInt8(n?128:0,r-1):n&&(i[r-1]|=128),i}},__Buffer_52=_$safeBuffer_345.Buffer,OP_INT_BASE=_$index_38.OP_RESERVED;function isPushOnlyChunk(t){return _$types_78.Buffer(t)||function(t){return _$types_78.Number(t)&&(t===_$index_38.OP_0||t>=_$index_38.OP_1&&t<=_$index_38.OP_16||t===_$index_38.OP_1NEGATE)}(t)}function isPushOnly(t){return _$types_78.Array(t)&&t.every(isPushOnlyChunk)}function asMinimalOP(t){return 0===t.length?_$index_38.OP_0:1===t.length?t[0]>=1&&t[0]<=16?OP_INT_BASE+t[0]:129===t[0]?_$index_38.OP_1NEGATE:void 0:void 0}function __compile_52(t){if(__Buffer_52.isBuffer(t))return t;_$typeforce_388(_$types_78.Array,t);var e=t.reduce((function(t,e){return __Buffer_52.isBuffer(e)?1===e.length&&void 0!==asMinimalOP(e)?t+1:t+_$pushdataBitcoin_97.encodingLength(e.length)+e.length:t+1}),0),r=__Buffer_52.allocUnsafe(e),i=0;if(t.forEach((function(t){if(__Buffer_52.isBuffer(t)){var e=asMinimalOP(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=_$pushdataBitcoin_97.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function decompile(t){if(_$types_78.Array(t))return t;_$typeforce_388(_$types_78.Buffer,t);for(var e=[],r=0;r_$index_38.OP_0&&i<=_$index_38.OP_PUSHDATA4){var n=_$pushdataBitcoin_97.decode(t,r);if(null===n)return[];r+=n.size;var o=t.slice(r,r+n.number);r+=n.number;var a=asMinimalOP(o);void 0!==a?e.push(a):e.push(o)}else e.push(i),r+=1}return e}function isDefinedHashType(t){var e=-193&t;return e>0&&e<4}var _$script_52={compile:__compile_52,compile2:function(t){if(__Buffer_52.isBuffer(t))return t;var e=t.reduce((function(t,e){return __Buffer_52.isBuffer(e)?t+_$pushdataBitcoin_97.encodingLength(e.length)+e.length:t+1}),0),r=__Buffer_52.allocUnsafe(e),i=0;if(t.forEach((function(t,e){__Buffer_52.isBuffer(t)?(i+=_$pushdataBitcoin_97.encode(r,t.length,i),t.copy(r,i),i+=t.length):(r.writeUInt8(t,i),i+=1)})),i!==r.length)throw new Error("Could not decode chunks");return r},decompile:decompile,fromASM:function(t){return _$typeforce_388(_$types_78.String,t),__compile_52(t.split(" ").map((function(t){return void 0!==_$index_38[t]?_$index_38[t]:__Buffer_52.from(t,"hex")})))},toASM:function(t){return __Buffer_52.isBuffer(t)&&(t=decompile(t)),t.map((function(t){if(__Buffer_52.isBuffer(t)){var e=asMinimalOP(t);if(void 0===e)return t.toString("hex");t=e}return _$map_39[t]})).join(" ")},toStack:function(t){return t=decompile(t),_$typeforce_388(isPushOnly,t),t.map((function(t){return __Buffer_52.isBuffer(t)?t:t===_$index_38.OP_0?__Buffer_52.allocUnsafe(0):_$script_number_53.encode(t-OP_INT_BASE)}))},number:_$script_number_53,isCanonicalPubKey:function(t){if(!__Buffer_52.isBuffer(t))return!1;if(t.length<33)return!1;switch(t[0]){case 2:case 3:return 33===t.length;case 4:return 65===t.length}return!1},isCanonicalSignature:function(t){return!!__Buffer_52.isBuffer(t)&&!!isDefinedHashType(t[t.length-1])&&(65===t.length||_$bip66_187.check(t.slice(0,-1)))},isPushOnly:isPushOnly,isDefinedHashType:isDefinedHashType},_$output_57={},__OP_INT_BASE_57=_$index_38.OP_RESERVED;function check(t,e){var r=_$script_52.decompile(t);if(r.length<4)return!1;if(r[r.length-1]!==_$index_38.OP_CHECKMULTISIG)return!1;if(!_$types_78.Number(r[0]))return!1;if(!_$types_78.Number(r[r.length-2]))return!1;var i=r[0]-__OP_INT_BASE_57,n=r[r.length-2]-__OP_INT_BASE_57;return!(i<=0)&&!(n>16)&&!(i>n)&&n===r.length-3&&(!!e||r.slice(1,-2).every(_$script_52.isCanonicalPubKey))}check.toJSON=function(){return"multi-sig output"},_$output_57={check:check,decode:function(t,e){var r=_$script_52.decompile(t);return _$typeforce_388(check,r,e),{m:r[0]-__OP_INT_BASE_57,pubKeys:r.slice(1,-2)}},encode:function(t,e){_$typeforce_388({m:_$types_78.Number,pubKeys:[_$script_52.isCanonicalPubKey]},{m:t,pubKeys:e});var r=e.length;if(rr.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(EMPTY_BUFFER,t.map((function(t){return t===_$index_38.OP_0?EMPTY_BUFFER:t})))}function decodeStack(t,e){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_56,t,e),t.slice(1)}var _$input_56={check:__check_56,decode:function(t,e){return decodeStack(_$script_52.decompile(t),e)},decodeStack:decodeStack,encode:function(t,e){return _$script_52.compile(encodeStack(t,e))},encodeStack:encodeStack},_$multisig_55={input:_$input_56,output:_$output_57},_$nulldata_58={};function __check_58(t){var e=_$script_52.compile(t);return e.length>1&&e[0]===_$index_38.OP_RETURN}__check_58.toJSON=function(){return"null data output"},_$nulldata_58={output:{check:__check_58,decode:function(t){return _$typeforce_388(__check_58,t),t.slice(2)},encode:function(t){return _$typeforce_388(_$types_78.Buffer,t),_$script_52.compile([_$index_38.OP_RETURN,t])}}};var _$input_60={};function __check_60(t){var e=_$script_52.decompile(t);return 1===e.length&&_$script_52.isCanonicalSignature(e[0])}function __encodeStack_60(t){return _$typeforce_388(_$script_52.isCanonicalSignature,t),[t]}function __decodeStack_60(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_60,t),t[0]}__check_60.toJSON=function(){return"pubKey input"},_$input_60={check:__check_60,decode:function(t){return __decodeStack_60(_$script_52.decompile(t))},decodeStack:__decodeStack_60,encode:function(t){return _$script_52.compile(__encodeStack_60(t))},encodeStack:__encodeStack_60};var _$output_61={};function __check_61(t){var e=_$script_52.decompile(t);return 2===e.length&&_$script_52.isCanonicalPubKey(e[0])&&e[1]===_$index_38.OP_CHECKSIG}__check_61.toJSON=function(){return"pubKey output"},_$output_61={check:__check_61,decode:function(t){var e=_$script_52.decompile(t);return _$typeforce_388(__check_61,e),e[0]},encode:function(t){return _$typeforce_388(_$script_52.isCanonicalPubKey,t),_$script_52.compile([t,_$index_38.OP_CHECKSIG])}};var _$pubkey_59={input:_$input_60,output:_$output_61},_$input_63={};function __check_63(t){var e=_$script_52.decompile(t);return 2===e.length&&_$script_52.isCanonicalSignature(e[0])&&_$script_52.isCanonicalPubKey(e[1])}function __encodeStack_63(t,e){return _$typeforce_388({signature:_$script_52.isCanonicalSignature,pubKey:_$script_52.isCanonicalPubKey},{signature:t,pubKey:e}),[t,e]}function __decodeStack_63(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_63,t),{signature:t[0],pubKey:t[1]}}__check_63.toJSON=function(){return"pubKeyHash input"},_$input_63={check:__check_63,decode:function(t){return __decodeStack_63(_$script_52.decompile(t))},decodeStack:__decodeStack_63,encode:function(t,e){return _$script_52.compile(__encodeStack_63(t,e))},encodeStack:__encodeStack_63};var _$output_64={};function __check_64(t){var e=_$script_52.compile(t);return 25===e.length&&e[0]===_$index_38.OP_DUP&&e[1]===_$index_38.OP_HASH160&&20===e[2]&&e[23]===_$index_38.OP_EQUALVERIFY&&e[24]===_$index_38.OP_CHECKSIG}__check_64.toJSON=function(){return"pubKeyHash output"},_$output_64={check:__check_64,decode:function(t){return _$typeforce_388(__check_64,t),t.slice(3,23)},encode:function(t){return _$typeforce_388(_$types_78.Hash160bit,t),_$script_52.compile([_$index_38.OP_DUP,_$index_38.OP_HASH160,t,_$index_38.OP_EQUALVERIFY,_$index_38.OP_CHECKSIG])}};var _$pubkeyhash_62={input:_$input_63,output:_$output_64},_$output_72={};function __check_72(t){var e=_$script_52.compile(t);return 22===e.length&&e[0]===_$index_38.OP_0&&20===e[1]}__check_72.toJSON=function(){return"Witness pubKeyHash output"},_$output_72={check:__check_72,decode:function(t){return _$typeforce_388(__check_72,t),t.slice(2)},encode:function(t){return _$typeforce_388(_$types_78.Hash160bit,t),_$script_52.compile([_$index_38.OP_0,t])}};var _$output_75={};function __check_75(t){var e=_$script_52.compile(t);return 34===e.length&&e[0]===_$index_38.OP_0&&32===e[1]}__check_75.toJSON=function(){return"Witness scriptHash output"},_$output_75={check:__check_75,decode:function(t){return _$typeforce_388(__check_75,t),t.slice(2)},encode:function(t){return _$typeforce_388(_$types_78.Hash256bit,t),_$script_52.compile([_$index_38.OP_0,t])}};var _$input_66={},__Buffer_66=_$safeBuffer_345.Buffer;function __check_66(t,e){var r=_$script_52.decompile(t);if(r.length<1)return!1;var i=r[r.length-1];if(!__Buffer_66.isBuffer(i))return!1;var n=_$script_52.decompile(_$script_52.compile(r.slice(0,-1))),o=_$script_52.decompile(i);return 0!==o.length&&!!_$script_52.isPushOnly(n)&&(1===r.length?_$output_75.check(o)||_$output_72.check(o):!(!_$pubkeyhash_62.input.check(n)||!_$pubkeyhash_62.output.check(o))||!(!_$multisig_55.input.check(n,e)||!_$multisig_55.output.check(o))||!(!_$pubkey_59.input.check(n)||!_$pubkey_59.output.check(o)))}function __encodeStack_66(t,e){var r=_$script_52.compile(e);return[].concat(t,r)}function __decodeStack_66(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_66,t),{redeemScriptStack:t.slice(0,-1),redeemScript:t[t.length-1]}}__check_66.toJSON=function(){return"scriptHash input"},_$input_66={check:__check_66,decode:function(t){var e=__decodeStack_66(_$script_52.decompile(t));return e.redeemScriptSig=_$script_52.compile(e.redeemScriptStack),delete e.redeemScriptStack,e},decodeStack:__decodeStack_66,encode:function(t,e){var r=_$script_52.decompile(t);return _$script_52.compile(__encodeStack_66(r,e))},encodeStack:__encodeStack_66};var _$output_67={};function __check_67(t){var e=_$script_52.compile(t);return 23===e.length&&e[0]===_$index_38.OP_HASH160&&20===e[1]&&e[22]===_$index_38.OP_EQUAL}__check_67.toJSON=function(){return"scriptHash output"},_$output_67={check:__check_67,decode:function(t){return _$typeforce_388(__check_67,t),t.slice(2,22)},encode:function(t){return _$typeforce_388(_$types_78.Hash160bit,t),_$script_52.compile([_$index_38.OP_HASH160,t,_$index_38.OP_EQUAL])}};var _$scripthash_65={input:_$input_66,output:_$output_67},_$input_71={};function isCompressedCanonicalPubKey(t){return _$script_52.isCanonicalPubKey(t)&&33===t.length}function __check_71(t){var e=_$script_52.decompile(t);return 2===e.length&&_$script_52.isCanonicalSignature(e[0])&&isCompressedCanonicalPubKey(e[1])}__check_71.toJSON=function(){return"witnessPubKeyHash input"},_$input_71={check:__check_71,decodeStack:function(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_71,t),{signature:t[0],pubKey:t[1]}},encodeStack:function(t,e){return _$typeforce_388({signature:_$script_52.isCanonicalSignature,pubKey:isCompressedCanonicalPubKey},{signature:t,pubKey:e}),[t,e]}};var _$witnesspubkeyhash_70={input:_$input_71,output:_$output_72},_$input_74={};(function(t){function e(e,r){if(_$typeforce_388(_$types_78.Array,e),e.length<1)return!1;var i=e[e.length-1];if(!t.isBuffer(i))return!1;var n=_$script_52.decompile(i);if(0===n.length)return!1;var o=_$script_52.compile(e.slice(0,-1));return!(!_$pubkeyhash_62.input.check(o)||!_$pubkeyhash_62.output.check(n))||!(!_$multisig_55.input.check(o,r)||!_$multisig_55.output.check(n))||!(!_$pubkey_59.input.check(o)||!_$pubkey_59.output.check(n))}e.toJSON=function(){return"witnessScriptHash input"},_$input_74={check:e,decodeStack:function(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(e,t),{witnessData:t.slice(0,-1),witnessScript:t[t.length-1]}},encodeStack:function(t,e){return _$typeforce_388({witnessData:[_$types_78.Buffer],witnessScript:_$types_78.Buffer},{witnessData:t,witnessScript:e}),[].concat(t,e)}}}).call(this,{isBuffer:_$isBuffer_531});var _$witnessscripthash_73={input:_$input_74,output:_$output_75},_$output_69={},__Buffer_69=_$safeBuffer_345.Buffer,HEADER=__Buffer_69.from("aa21a9ed","hex");function __check_69(t){var e=_$script_52.compile(t);return e.length>37&&e[0]===_$index_38.OP_RETURN&&36===e[1]&&e.slice(2,6).equals(HEADER)}__check_69.toJSON=function(){return"Witness commitment output"},_$output_69={check:__check_69,decode:function(t){return _$typeforce_388(__check_69,t),_$script_52.decompile(t)[1].slice(4,36)},encode:function(t){_$typeforce_388(_$types_78.Hash256bit,t);var e=__Buffer_69.allocUnsafe(36);return HEADER.copy(e,0),t.copy(e,4),_$script_52.compile([_$index_38.OP_RETURN,e])}};for(var _$witnesscommitment_68={output:_$output_69},__decompile_54=_$script_52.decompile,__types_54={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"},_$templates_54={classifyInput:function(t,e){var r=__decompile_54(t);return _$pubkeyhash_62.input.check(r)?__types_54.P2PKH:_$scripthash_65.input.check(r,e)?__types_54.P2SH:_$multisig_55.input.check(r,e)?__types_54.MULTISIG:_$pubkey_59.input.check(r)?__types_54.P2PK:__types_54.NONSTANDARD},classifyOutput:function(t){if(_$witnesspubkeyhash_70.output.check(t))return __types_54.P2WPKH;if(_$witnessscripthash_73.output.check(t))return __types_54.P2WSH;if(_$pubkeyhash_62.output.check(t))return __types_54.P2PKH;if(_$scripthash_65.output.check(t))return __types_54.P2SH;var e=__decompile_54(t);return _$multisig_55.output.check(e)?__types_54.MULTISIG:_$pubkey_59.output.check(e)?__types_54.P2PK:_$witnesscommitment_68.output.check(e)?__types_54.WITNESS_COMMITMENT:_$nulldata_58.output.check(e)?__types_54.NULLDATA:__types_54.NONSTANDARD},classifyWitness:function(t,e){var r=__decompile_54(t);return _$witnesspubkeyhash_70.input.check(r)?__types_54.P2WPKH:_$witnessscripthash_73.input.check(r,e)?__types_54.P2WSH:__types_54.NONSTANDARD},multisig:_$multisig_55,nullData:_$nulldata_58,pubKey:_$pubkey_59,pubKeyHash:_$pubkeyhash_62,scriptHash:_$scripthash_65,witnessPubKeyHash:_$witnesspubkeyhash_70,witnessScriptHash:_$witnessscripthash_73,witnessCommitment:_$witnesscommitment_68,types:__types_54},ALPHABET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={},z=0;z>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function prefixChk(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=polymodStep(e)^i>>5}for(e=polymodStep(e),r=0;re)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),a=t.slice(n+1);if(a.length<6)return"Data too short";var s=prefixChk(o);if("string"==typeof s)return s;for(var u=[],h=0;h=a.length||u.push(c)}return 1!==s?"Invalid checksum for "+t:{prefix:o,words:u}}function convert(t,e,r,i){for(var n=0,o=0,a=(1<=r;)o-=r,s.push(n>>o&a);if(i)o>0&&s.push(n<=e)return"Excess padding";if(n<r)throw new TypeError("Exceeds length limit");var i=prefixChk(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");i=polymodStep(i)^a,n+=ALPHABET.charAt(a)}for(o=0;o<6;++o)i=polymodStep(i);for(i^=1,o=0;o<6;++o){var s=i>>5*(5-o)&31;n+=ALPHABET.charAt(s)}return n},toWords:function(t){var e=convert(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWords:function(t){var e=convert(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}},_$inherits_browser_317={};_$inherits_browser_317="function"==typeof Object.create?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var _$events_498={},objectCreate=Object.create||function(t){var e=function(){};return e.prototype=t,new e},objectKeys=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},bind=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function EventEmitter(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=objectCreate(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}_$events_498=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0;var hasDefineProperty,defaultMaxListeners=10;try{var o={};Object.defineProperty&&Object.defineProperty(o,"x",{value:0}),hasDefineProperty=0===o.x}catch(err){hasDefineProperty=!1}function $getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function _addListener(t,e,r,i){var n,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]):(o=t._events=objectCreate(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(n=$getMaxListeners(t))&&n>0&&a.length>n){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else a=o[e]=r,++t._eventsCount;return t}function onceWrapper(){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 u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(r=a[t]))return!1;var h="function"==typeof r;switch(i=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var i=t.length,n=arrayClone(t,i),o=0;o=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(t,e){for(var r=e,i=r+1,n=t.length;i=0;i--)this.removeListener(t,e[i]);return this},EventEmitter.prototype.listeners=function(t){return _listeners(this,t,!0)},EventEmitter.prototype.rawListeners=function(t){return _listeners(this,t,!1)},EventEmitter.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):listenerCount.call(t,e)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var _$streamBrowser_302=_$events_498.EventEmitter;function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _defineProperties(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 __Buffer_296.alloc(0);for(var e,r,i,n=__Buffer_296.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_296.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_296.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:custom,value:function(t,e){return inspect(this,function(t){for(var e=1;e1)for(var r=1;r2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(oneOf(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(oneOf(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_289.codes=codes;var ERR_INVALID_OPT_VALUE=_$errorsBrowser_289.codes.ERR_INVALID_OPT_VALUE,_$state_301={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new ERR_INVALID_OPT_VALUE(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$browser_391={};(function(t){function e(e){try{if(!t.localStorage)return!1}catch(i){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}_$browser_391=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$safeBuffer_371={},__buffer_371=_$buffer_460({}),__Buffer_371=__buffer_371.Buffer;function __copyProps_371(t,e){for(var r in t)e[r]=t[r]}function __SafeBuffer_371(t,e,r){return __Buffer_371(t,e,r)}__Buffer_371.from&&__Buffer_371.alloc&&__Buffer_371.allocUnsafe&&__Buffer_371.allocUnsafeSlow?_$safeBuffer_371=__buffer_371:(__copyProps_371(__buffer_371,_$safeBuffer_371),_$safeBuffer_371.Buffer=__SafeBuffer_371),__copyProps_371(__Buffer_371,__SafeBuffer_371),__SafeBuffer_371.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return __Buffer_371(t,e,r)},__SafeBuffer_371.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=__Buffer_371(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},__SafeBuffer_371.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __Buffer_371(t)},__SafeBuffer_371.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __buffer_371.SlowBuffer(t)};var _$Transform_293=Transform,_require$codes=_$errorsBrowser_289.codes,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=_require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=_require$codes.ERR_TRANSFORM_WITH_LENGTH_0,Duplex=_$Duplex_290({});function afterTransform(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new ERR_MULTIPLE_CALLBACK);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(call),a||(o.forEach(call),n(i))}))}));return e.reduce(pipe)},_$readableBrowser_303={};_$readableBrowser_303=_$readableBrowser_303=_$_stream_readable_292({}),_$readableBrowser_303.Stream=_$readableBrowser_303,_$readableBrowser_303.Readable=_$readableBrowser_303,_$readableBrowser_303.Writable=_$_stream_writable_294({}),_$readableBrowser_303.Duplex=_$Duplex_290({}),_$readableBrowser_303.Transform=_$Transform_293,_$readableBrowser_303.PassThrough=_$PassThrough_291,_$readableBrowser_303.finished=_$eos_298({}),_$readableBrowser_303.pipeline=_$pipeline_300;var _$hashBase_288={},__Buffer_288=_$safeBuffer_345.Buffer,__Transform_288=_$readableBrowser_303.Transform;function HashBase(t){__Transform_288.call(this),this._block=__Buffer_288.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}_$inherits_browser_317(HashBase,__Transform_288),HashBase.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(err){i=err}r(i)},HashBase.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(err){e=err}t(e)},HashBase.prototype.update=function(t,e){if(function(t,e){if(!__Buffer_288.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");__Buffer_288.isBuffer(t)||(t=__Buffer_288.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var n=this._blockOffset;n0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},_$hashBase_288=HashBase;var _$md5Js_321={},__Buffer_321=_$safeBuffer_345.Buffer,ARRAY16=new Array(16);function MD5(){_$hashBase_288.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(t,e){return t<>>32-e}function fnF(t,e,r,i,n,o,a){return rotl(t+(e&r|~e&i)+n+o|0,a)+e|0}function fnG(t,e,r,i,n,o,a){return rotl(t+(e&i|r&~i)+n+o|0,a)+e|0}function fnH(t,e,r,i,n,o,a){return rotl(t+(e^r^i)+n+o|0,a)+e|0}function fnI(t,e,r,i,n,o,a){return rotl(t+(r^(e|~i))+n+o|0,a)+e|0}_$inherits_browser_317(MD5,_$hashBase_288),MD5.prototype._update=function(){for(var t=ARRAY16,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=fnF(r,i,n,o,t[0],3614090360,7),o=fnF(o,r,i,n,t[1],3905402710,12),n=fnF(n,o,r,i,t[2],606105819,17),i=fnF(i,n,o,r,t[3],3250441966,22),r=fnF(r,i,n,o,t[4],4118548399,7),o=fnF(o,r,i,n,t[5],1200080426,12),n=fnF(n,o,r,i,t[6],2821735955,17),i=fnF(i,n,o,r,t[7],4249261313,22),r=fnF(r,i,n,o,t[8],1770035416,7),o=fnF(o,r,i,n,t[9],2336552879,12),n=fnF(n,o,r,i,t[10],4294925233,17),i=fnF(i,n,o,r,t[11],2304563134,22),r=fnF(r,i,n,o,t[12],1804603682,7),o=fnF(o,r,i,n,t[13],4254626195,12),n=fnF(n,o,r,i,t[14],2792965006,17),r=fnG(r,i=fnF(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=fnG(o,r,i,n,t[6],3225465664,9),n=fnG(n,o,r,i,t[11],643717713,14),i=fnG(i,n,o,r,t[0],3921069994,20),r=fnG(r,i,n,o,t[5],3593408605,5),o=fnG(o,r,i,n,t[10],38016083,9),n=fnG(n,o,r,i,t[15],3634488961,14),i=fnG(i,n,o,r,t[4],3889429448,20),r=fnG(r,i,n,o,t[9],568446438,5),o=fnG(o,r,i,n,t[14],3275163606,9),n=fnG(n,o,r,i,t[3],4107603335,14),i=fnG(i,n,o,r,t[8],1163531501,20),r=fnG(r,i,n,o,t[13],2850285829,5),o=fnG(o,r,i,n,t[2],4243563512,9),n=fnG(n,o,r,i,t[7],1735328473,14),r=fnH(r,i=fnG(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=fnH(o,r,i,n,t[8],2272392833,11),n=fnH(n,o,r,i,t[11],1839030562,16),i=fnH(i,n,o,r,t[14],4259657740,23),r=fnH(r,i,n,o,t[1],2763975236,4),o=fnH(o,r,i,n,t[4],1272893353,11),n=fnH(n,o,r,i,t[7],4139469664,16),i=fnH(i,n,o,r,t[10],3200236656,23),r=fnH(r,i,n,o,t[13],681279174,4),o=fnH(o,r,i,n,t[0],3936430074,11),n=fnH(n,o,r,i,t[3],3572445317,16),i=fnH(i,n,o,r,t[6],76029189,23),r=fnH(r,i,n,o,t[9],3654602809,4),o=fnH(o,r,i,n,t[12],3873151461,11),n=fnH(n,o,r,i,t[15],530742520,16),r=fnI(r,i=fnH(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=fnI(o,r,i,n,t[7],1126891415,10),n=fnI(n,o,r,i,t[14],2878612391,15),i=fnI(i,n,o,r,t[5],4237533241,21),r=fnI(r,i,n,o,t[12],1700485571,6),o=fnI(o,r,i,n,t[3],2399980690,10),n=fnI(n,o,r,i,t[10],4293915773,15),i=fnI(i,n,o,r,t[1],2240044497,21),r=fnI(r,i,n,o,t[8],1873313359,6),o=fnI(o,r,i,n,t[15],4264355552,10),n=fnI(n,o,r,i,t[6],2734768916,15),i=fnI(i,n,o,r,t[13],1309151649,21),r=fnI(r,i,n,o,t[4],4149444226,6),o=fnI(o,r,i,n,t[11],3174756917,10),n=fnI(n,o,r,i,t[2],718787259,15),i=fnI(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=__Buffer_321.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},_$md5Js_321=MD5;var _$ripemd160_344={},__Buffer_344=_$buffer_460({}).Buffer,__ARRAY16_344=new Array(16),zl=[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],zr=[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],sl=[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],sr=[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],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){_$hashBase_288.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function __rotl_344(t,e){return t<>>32-e}function fn1(t,e,r,i,n,o,a,s){return __rotl_344(t+(e^r^i)+o+a|0,s)+n|0}function fn2(t,e,r,i,n,o,a,s){return __rotl_344(t+(e&r|~e&i)+o+a|0,s)+n|0}function fn3(t,e,r,i,n,o,a,s){return __rotl_344(t+((e|~r)^i)+o+a|0,s)+n|0}function fn4(t,e,r,i,n,o,a,s){return __rotl_344(t+(e&i|r&~i)+o+a|0,s)+n|0}function fn5(t,e,r,i,n,o,a,s){return __rotl_344(t+(e^(r|~i))+o+a|0,s)+n|0}_$inherits_browser_317(RIPEMD160,_$hashBase_288),RIPEMD160.prototype._update=function(){for(var t=__ARRAY16_344,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,f=0|this._d,c=0|this._e,l=0;l<80;l+=1){var _,d;l<16?(_=fn1(r,i,n,o,a,t[zl[l]],hl[0],sl[l]),d=fn5(s,u,h,f,c,t[zr[l]],hr[0],sr[l])):l<32?(_=fn2(r,i,n,o,a,t[zl[l]],hl[1],sl[l]),d=fn4(s,u,h,f,c,t[zr[l]],hr[1],sr[l])):l<48?(_=fn3(r,i,n,o,a,t[zl[l]],hl[2],sl[l]),d=fn3(s,u,h,f,c,t[zr[l]],hr[2],sr[l])):l<64?(_=fn4(r,i,n,o,a,t[zl[l]],hl[3],sl[l]),d=fn2(s,u,h,f,c,t[zr[l]],hr[3],sr[l])):(_=fn5(r,i,n,o,a,t[zl[l]],hl[4],sl[l]),d=fn1(s,u,h,f,c,t[zr[l]],hr[4],sr[l])),r=a,a=o,o=__rotl_344(n,10),n=i,i=_,s=c,c=f,f=__rotl_344(h,10),h=u,u=d}var p=this._b+n+f|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+i+h|0,this._a=p},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=__Buffer_344.alloc?__Buffer_344.alloc(20):new __Buffer_344(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},_$ripemd160_344=RIPEMD160;var _$hash_357={},__Buffer_357=_$safeBuffer_345.Buffer;function Hash(t,e){this._block=__Buffer_357.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Hash.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=__Buffer_357.from(t,e));for(var r=this._block,i=this._blockSize,n=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_$hash_357=Hash;var _$sha_359={},__Buffer_359=_$safeBuffer_345.Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha(){this.init(),this._w=W,_$hash_357.call(this,64,56)}function rotl30(t){return t<<30|t>>>2}function ft(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_317(Sha,_$hash_357),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var f=~~(h/20),c=0|((e=i)<<5|e>>>27)+ft(f,n,o,a)+s+r[h]+K[f];s=a,a=o,o=rotl30(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Sha.prototype._hash=function(){var t=__Buffer_359.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},_$sha_359=Sha;var _$sha1_360={},__Buffer_360=_$safeBuffer_345.Buffer,__K_360=[1518500249,1859775393,-1894007588,-899497514],__W_360=new Array(80);function Sha1(){this.init(),this._w=__W_360,_$hash_357.call(this,64,56)}function rotl5(t){return t<<5|t>>>27}function __rotl30_360(t){return t<<30|t>>>2}function __ft_360(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_317(Sha1,_$hash_357),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=(e=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|e>>>31;for(var h=0;h<80;++h){var f=~~(h/20),c=rotl5(i)+__ft_360(f,n,o,a)+s+r[h]+__K_360[f]|0;s=a,a=o,o=__rotl30_360(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Sha1.prototype._hash=function(){var t=__Buffer_360.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},_$sha1_360=Sha1;var _$sha256_362={},__Buffer_362=_$safeBuffer_345.Buffer,__K_362=[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],__W_362=new Array(64);function Sha256(){this.init(),this._w=__W_362,_$hash_357.call(this,64,56)}function ch(t,e,r){return r^t&(e^r)}function maj(t,e,r){return t&e|r&(t|e)}function sigma0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sigma1(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function gamma0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}_$inherits_browser_317(Sha256,_$hash_357),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,f=0|this._h,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<64;++c)r[c]=0|(((e=r[c-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[c-7]+gamma0(r[c-15])+r[c-16];for(var l=0;l<64;++l){var _=f+sigma1(s)+ch(s,u,h)+__K_362[l]+r[l]|0,d=sigma0(i)+maj(i,n,o)|0;f=h,h=u,u=s,s=a+_|0,a=o,o=n,n=i,i=_+d|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=f+this._h|0},Sha256.prototype._hash=function(){var t=__Buffer_362.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},_$sha256_362=Sha256;var _$sha224_361={},__Buffer_361=_$safeBuffer_345.Buffer,__W_361=new Array(64);function Sha224(){this.init(),this._w=__W_361,_$hash_357.call(this,64,56)}_$inherits_browser_317(Sha224,_$sha256_362),Sha224.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},Sha224.prototype._hash=function(){var t=__Buffer_361.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},_$sha224_361=Sha224;var _$sha512_364={},__Buffer_364=_$safeBuffer_345.Buffer,__K_364=[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],__W_364=new Array(160);function Sha512(){this.init(),this._w=__W_364,_$hash_357.call(this,128,112)}function Ch(t,e,r){return r^t&(e^r)}function __maj_364(t,e,r){return t&e|r&(t|e)}function __sigma0_364(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function __sigma1_364(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Gamma0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Gamma0l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function Gamma1(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Gamma1l(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function getCarry(t,e){return t>>>0>>0?1:0}_$inherits_browser_317(Sha512,_$hash_357),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,f=0|this._al,c=0|this._bl,l=0|this._cl,_=0|this._dl,d=0|this._el,p=0|this._fl,m=0|this._gl,b=0|this._hl,g=0;g<32;g+=2)e[g]=t.readInt32BE(4*g),e[g+1]=t.readInt32BE(4*g+4);for(;g<160;g+=2){var v=e[g-30],y=e[g-30+1],w=Gamma0(v,y),M=Gamma0l(y,v),S=Gamma1(v=e[g-4],y=e[g-4+1]),$=Gamma1l(y,v),E=e[g-14],k=e[g-14+1],A=e[g-32],B=e[g-32+1],x=M+k|0,T=w+E+getCarry(x,M)|0;T=(T=T+S+getCarry(x=x+$|0,$)|0)+A+getCarry(x=x+B|0,B)|0,e[g]=T,e[g+1]=x}for(var P=0;P<160;P+=2){T=e[P],x=e[P+1];var R=__maj_364(r,i,n),I=__maj_364(f,c,l),C=__sigma0_364(r,f),O=__sigma0_364(f,r),N=__sigma1_364(a,d),L=__sigma1_364(d,a),U=__K_364[P],D=__K_364[P+1],z=Ch(a,s,u),j=Ch(d,p,m),H=b+L|0,q=h+N+getCarry(H,b)|0;q=(q=(q=q+z+getCarry(H=H+j|0,j)|0)+U+getCarry(H=H+D|0,D)|0)+T+getCarry(H=H+x|0,x)|0;var F=O+I|0,K=C+R+getCarry(F,O)|0;h=u,b=m,u=s,m=p,s=a,p=d,a=o+q+getCarry(d=_+H|0,_)|0,o=n,_=l,n=i,l=c,i=r,c=f,r=q+K+getCarry(f=H+F|0,H)|0}this._al=this._al+f|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+_|0,this._el=this._el+d|0,this._fl=this._fl+p|0,this._gl=this._gl+m|0,this._hl=this._hl+b|0,this._ah=this._ah+r+getCarry(this._al,f)|0,this._bh=this._bh+i+getCarry(this._bl,c)|0,this._ch=this._ch+n+getCarry(this._cl,l)|0,this._dh=this._dh+o+getCarry(this._dl,_)|0,this._eh=this._eh+a+getCarry(this._el,d)|0,this._fh=this._fh+s+getCarry(this._fl,p)|0,this._gh=this._gh+u+getCarry(this._gl,m)|0,this._hh=this._hh+h+getCarry(this._hl,b)|0},Sha512.prototype._hash=function(){var t=__Buffer_364.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha512_364=Sha512;var _$sha384_363={},__Buffer_363=_$safeBuffer_345.Buffer,__W_363=new Array(160);function Sha384(){this.init(),this._w=__W_363,_$hash_357.call(this,128,112)}_$inherits_browser_317(Sha384,_$sha512_364),Sha384.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},Sha384.prototype._hash=function(){var t=__Buffer_363.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha384_363=Sha384;var _$shaJs_358={},exports=_$shaJs_358=function(t){t=t.toLowerCase();var e=exports[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};exports.sha=_$sha_359,exports.sha1=_$sha1_360,exports.sha224=_$sha224_361,exports.sha256=_$sha256_362,exports.sha384=_$sha384_363,exports.sha512=_$sha512_364;var _$inherits_browser_530={};_$inherits_browser_530="function"==typeof Object.create?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var _$processNextickArgs_549={};(function(t){"use strict";_$processNextickArgs_549=void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?{nextTick:function(e,r,i,n){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,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(o=new Array(s-1),a=0;a0?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 __Buffer_566.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i=__Buffer_566.allocUnsafe(t>>>0),n=this.head,o=0;n;)e=i,r=o,n.data.copy(e,r),o+=n.data.length,n=n.next;return i},t}(),util&&util.inspect&&util.inspect.custom&&(_$BufferList_566.prototype[util.inspect.custom]=function(){var t=util.inspect({length:this.length});return this.constructor.name+" "+t});var _$destroy_567={destroy:function(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||_$processNextickArgs_549.nextTick(emitErrorNT,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(_$processNextickArgs_549.nextTick(emitErrorNT,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)}},_$browser_588={};(function(t){function e(e){try{if(!t.localStorage)return!1}catch(i){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}_$browser_588=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$Transform_564=__Transform_564,__Duplex_564=_$Duplex_561({}),__util_564=Object.create(_$util_462);function __afterTransform_564(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var c=0,l=o-1;(0!==f||c>>0,h[l]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");n=c,r++}if(" "!==t[r]){for(var _=o-n;_!==o&&0===h[_];)_++;var d=_Buffer.allocUnsafe(i+(o-_));d.fill(0,0,i);for(var p=i;_!==o;)d[p++]=h[_++];return d}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=_Buffer.from(e)),!_Buffer.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,n=0,o=e.length;n!==o&&0===e[n];)n++,r++;for(var u=(o-n)*h+1>>>0,f=new Uint8Array(u);n!==o;){for(var c=e[n],l=0,_=u-1;(0!==c||l>>0,f[_]=c%a>>>0,c=c/a>>>0;if(0!==c)throw new Error("Non-zero carry");i=l,n++}for(var d=u-i;d!==u&&0===f[d];)d++;for(var p=s.repeat(r);d21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function fromBech32(t){var e=_$bech32_161.decode(t),r=_$bech32_161.fromWords(e.words.slice(1));return{version:e.words[0],prefix:e.prefix,data:__Buffer_40.from(r)}}function toBase58Check(t,e){_$typeforce_388(_$types_78.tuple(_$types_78.Hash160bit,_$types_78.UInt8),arguments);var r=__Buffer_40.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),_$bs58check_210.encode(r)}function toBech32(t,e,r){var i=_$bech32_161.toWords(t);return i.unshift(e),_$bech32_161.encode(r,i)}var _$address_40={fromBase58Check:fromBase58Check,fromBech32:fromBech32,fromOutputScript:function(t,e){if(e=e||_$networks_49.bitcoin,_$templates_54.pubKeyHash.output.check(t))return toBase58Check(_$script_52.compile(t).slice(3,23),e.pubKeyHash);if(_$templates_54.scriptHash.output.check(t))return toBase58Check(_$script_52.compile(t).slice(2,22),e.scriptHash);if(_$templates_54.witnessPubKeyHash.output.check(t))return toBech32(_$script_52.compile(t).slice(2,22),0,e.bech32);if(_$templates_54.witnessScriptHash.output.check(t))return toBech32(_$script_52.compile(t).slice(2,34),0,e.bech32);throw new Error(_$script_52.toASM(t)+" has no matching Address")},toBase58Check:toBase58Check,toBech32:toBech32,toOutputScript:function(t,e){var r;e=e||_$networks_49.bitcoin;try{r=fromBase58Check(t)}catch(i){}if(r){if(r.version===e.pubKeyHash)return _$templates_54.pubKeyHash.output.encode(r.hash);if(r.version===e.scriptHash)return _$templates_54.scriptHash.output.encode(r.hash)}else{try{r=fromBech32(t)}catch(i){}if(r){if(r.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return _$templates_54.witnessPubKeyHash.output.encode(r.data);if(32===r.data.length)return _$templates_54.witnessScriptHash.output.encode(r.data)}}}throw new Error(t+" has no matching Script")}};function ripemd160(t){return _$browser_224("rmd160").update(t).digest()}function sha256(t){return _$browser_224("sha256").update(t).digest()}var _$crypto_43={hash160:function(t){return ripemd160(sha256(t))},hash256:function(t){return sha256(sha256(t))},ripemd160:ripemd160,sha1:function(t){return _$browser_224("sha1").update(t).digest()},sha256:sha256},_$package_167={version:"1.4.2"},_$bigi_164={};function BigInteger(t,e,r){if(!(this instanceof BigInteger))return new BigInteger(t,e,r);null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}var proto=BigInteger.prototype;proto.__bigi=_$package_167.version,BigInteger.isBigInteger=function(t,e){return t&&t.__bigi&&(!e||t.__bigi===proto.__bigi)},BigInteger.prototype.am=function(t,e,r,i,n,o){for(;--o>=0;){var a=e*this[t++]+r[i]+n;n=Math.floor(a/67108864),r[i++]=67108863&a}return n},BigInteger.prototype.DB=26,BigInteger.prototype.DM=67108863;var DV=BigInteger.prototype.DV=1<<26;BigInteger.prototype.FV=Math.pow(2,52),BigInteger.prototype.F1=26,BigInteger.prototype.F2=0;var rr,vv,BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array;for(rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){var r=BI_RC[t.charCodeAt(e)];return null==r?-1:r}function nbv(t){var e=new BigInteger;return e.fromInt(t),e}function nbits(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function Classic(t){this.m=t}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function cbit(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function NullExp(){}function nNop(t){return t}function Barrett(t){this.r2=new BigInteger,this.q3=new BigInteger,BigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}Classic.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},Classic.prototype.revert=function(t){return t},Classic.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},Classic.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Classic.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},Montgomery.prototype.convert=function(t){var e=new BigInteger;return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(BigInteger.ZERO)>0&&this.m.subTo(e,e),e},Montgomery.prototype.revert=function(t){var e=new BigInteger;return t.copyTo(e),this.reduce(e),e},Montgomery.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},Montgomery.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Montgomery.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},proto.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},proto.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0},proto.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var a=8==r?255&t[i]:intAt(t,i);a<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-o):this[this.t-1]|=a<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},proto.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},proto.drShiftTo=function(t,e){for(var r=t;r=0;--r)e[r+a+1]=this[r]>>n|s,s=(this[r]&o)<=0;--r)e[r]=0;e[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},proto.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<>i;for(var a=r+1;a>i;i>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()},proto.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},proto.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(u,o),n.lShiftTo(u,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,f=o[h-1];if(0!=f){var c=f*(1<1?o[h-2]>>this.F2:0),l=this.FV/c,_=(1<=0&&(r[r.t++]=1,r.subTo(b,r)),BigInteger.ONE.dlShiftTo(h,b),b.subTo(o,o);o.t=0;){var g=r[--p]==f?this.DM:Math.floor(r[p]*l+(r[p-1]+d)*_);if((r[p]+=o.am(0,g,r,m,0,h))0&&r.rShiftTo(u,r),a<0&&BigInteger.ZERO.subTo(r,r)}}},proto.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},proto.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},proto.exp=function(t,e){if(t>4294967295||t<1)return BigInteger.ONE;var r=new BigInteger,i=new BigInteger,n=e.convert(this),o=nbits(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var a=r;r=i,i=a}return e.revert(r)},proto.toString=function(t){var e;if(this.s<0)return"-"+this.negate().toString(t);if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(s>s)>0&&(n=!0,o=int2char(r));a>=0;)s>(s+=this.DB-e)):(r=this[a]>>(s-=e)&i,s<=0&&(s+=this.DB,--a)),r>0&&(n=!0),n&&(o+=int2char(r));return n?o:"0"},proto.negate=function(){var t=new BigInteger;return BigInteger.ZERO.subTo(this,t),t},proto.abs=function(){return this.s<0?this.negate():this},proto.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},proto.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)},proto.byteLength=function(){return this.bitLength()>>3},proto.mod=function(t){var e=new BigInteger;return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(BigInteger.ZERO)>0&&t.subTo(e,e),e},proto.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new Classic(e):new Montgomery(e),this.exp(t,r)},NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},NullExp.prototype.sqrTo=function(t,e){t.squareTo(e)},Barrett.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=new BigInteger;return t.copyTo(e),this.reduce(e),e},Barrett.prototype.revert=function(t){return t},Barrett.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},Barrett.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Barrett.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];proto.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},proto.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=nbv(r),n=new BigInteger,o=new BigInteger,a="";for(this.divRemTo(i,n,o);n.signum()>0;)a=(r+o.intValue()).toString(t).substr(1)+a,n.divRemTo(i,n,o);return o.intValue().toString(t)+a},proto.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,a=0,s=0;s=r&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(a,0)),n&&BigInteger.ZERO.subTo(this,this)},proto.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()},proto.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},proto.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},proto.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n=0;)r[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r},proto.millerRabin=function(t){var e=this.subtract(BigInteger.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);(t=t+1>>1)>lowprimes.length&&(t=lowprimes.length);for(var n=new BigInteger(null),o=[],a=0;a>24},proto.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},proto.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},proto.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this[t]&(1<>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0===n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},proto.equals=function(t){return 0==this.compareTo(t)},proto.min=function(t){return this.compareTo(t)<0?this:t},proto.max=function(t){return this.compareTo(t)>0?this:t},proto.and=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_and,e),e},proto.or=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_or,e),e},proto.xor=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_xor,e),e},proto.andNot=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_andnot,e),e},proto.not=function(){for(var t=new BigInteger,e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var f=new BigInteger;for(i.sqrTo(a[1],f);s<=h;)a[s]=new BigInteger,i.mulTo(f,a[s-2],a[s]),s+=2}var c,l,_=t.t-1,d=!0,p=new BigInteger;for(n=nbits(t[_])-1;_>=0;){for(n>=u?c=t[_]>>n-u&h:(c=(t[_]&(1<0&&(c|=t[_-1]>>this.DB+n-u)),s=r;0==(1&c);)c>>=1,--s;if((n-=s)<0&&(n+=this.DB,--_),d)a[c].copyTo(o),d=!1;else{for(;s>1;)i.sqrTo(o,p),i.sqrTo(p,o),s-=2;s>0?i.sqrTo(o,p):(l=o,o=p,p=l),i.mulTo(p,a[c],o)}for(;_>=0&&0==(t[_]&1<=0?(r.subTo(i,r),e&&n.subTo(a,n),o.subTo(s,o)):(i.subTo(r,i),e&&a.subTo(n,a),s.subTo(o,s))}if(0!=i.compareTo(BigInteger.ONE))return BigInteger.ZERO;for(;s.compareTo(t)>=0;)s.subTo(t,s);for(;s.signum()<0;)s.addTo(t,s);return s},proto.pow=function(t){return this.exp(t,new NullExp)},proto.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},proto.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=lowprimes[lowprimes.length-1]){for(e=0;e=4)throw new Error("Invalid hashType "+r);return{signature:e.fromDER(t.slice(0,-1)),hashType:r}},e.prototype.toCompact=function(e,r){r&&(e+=4),e+=27;var i=t.alloc(65);return i.writeUInt8(e,0),this.toRSBuffer(i,1),i},e.prototype.toDER=function(){var e=t.from(this.r.toDERInteger()),r=t.from(this.s.toDERInteger());return _$bip66_187.encode(e,r)},e.prototype.toRSBuffer=function(e,r){return r||(r=0),e=e||t.alloc(64),this.r.toBuffer(32).copy(e,r),this.s.toBuffer(32).copy(e,r+32),e},e.prototype.toScriptSignature=function(r,i){i||(i=e.ECDSA);var n=-193&r;if(n<=0||n>=4)throw new Error("Invalid hashType "+r);var o=t.alloc(1);if(o.writeUInt8(r,0),i===e.ECDSA)return t.concat([this.toDER(),o]);if(i===e.SCHNORR)return t.concat([this.toRSBuffer(),o]);throw new Error("Invalid signature Algorithm")},_$ecsignature_46=e}).call(this,_$buffer_460({}).Buffer);var _$point_270={},__Buffer_270=_$safeBuffer_345.Buffer,THREE=_$lib_166.valueOf(3);function Point(t,e,r,i){this.curve=t,this.x=e,this.y=r,this.z=i,this._zInv=null,this.compressed=!0}Object.defineProperty(Point.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInverse(this.curve.p)),this._zInv}}),Object.defineProperty(Point.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(Point.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),Point.fromAffine=function(t,e,r){return new Point(t,e,r,_$lib_166.ONE)},Point.prototype.equals=function(t){return t===this||(this.curve.isInfinity(this)?this.curve.isInfinity(t):this.curve.isInfinity(t)?this.curve.isInfinity(this):0===t.y.multiply(this.z).subtract(this.y.multiply(t.z)).mod(this.curve.p).signum()&&0===t.x.multiply(this.z).subtract(this.x.multiply(t.z)).mod(this.curve.p).signum())},Point.prototype.negate=function(){var t=this.curve.p.subtract(this.y);return new Point(this.curve,this.x,t,this.z)},Point.prototype.add=function(t){if(this.curve.isInfinity(this))return t;if(this.curve.isInfinity(t))return this;var e=this.x,r=this.y,i=t.x,n=t.y.multiply(this.z).subtract(r.multiply(t.z)).mod(this.curve.p),o=i.multiply(this.z).subtract(e.multiply(t.z)).mod(this.curve.p);if(0===o.signum())return 0===n.signum()?this.twice():this.curve.infinity;var a=o.square(),s=a.multiply(o),u=e.multiply(a),h=n.square().multiply(this.z),f=h.subtract(u.shiftLeft(1)).multiply(t.z).subtract(s).multiply(o).mod(this.curve.p),c=u.multiply(THREE).multiply(n).subtract(r.multiply(s)).subtract(h.multiply(n)).multiply(t.z).add(n.multiply(s)).mod(this.curve.p),l=s.multiply(this.z).multiply(t.z).mod(this.curve.p);return new Point(this.curve,f,c,l)},Point.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.signum())return this.curve.infinity;var t=this.x,e=this.y,r=e.multiply(this.z).mod(this.curve.p),i=r.multiply(e).mod(this.curve.p),n=this.curve.a,o=t.square().multiply(THREE);0!==n.signum()&&(o=o.add(this.z.square().multiply(n)));var a=(o=o.mod(this.curve.p)).square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(r).mod(this.curve.p),s=o.multiply(THREE).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(o.pow(3)).mod(this.curve.p),u=r.pow(3).shiftLeft(3).mod(this.curve.p);return new Point(this.curve,a,s,u)},Point.prototype.multiply=function(t){if(this.curve.isInfinity(this))return this;if(0===t.signum())return this.curve.infinity;for(var e=t,r=e.multiply(THREE),i=this.negate(),n=this,o=r.bitLength()-2;o>0;--o){var a=r.testBit(o),s=e.testBit(o);n=n.twice(),a!==s&&(n=n.add(a?this:i))}return n},Point.prototype.multiplyTwo=function(t,e,r){for(var i=Math.max(t.bitLength(),r.bitLength())-1,n=this.curve.infinity,o=this.add(e);i>=0;){var a=t.testBit(i),s=r.testBit(i);n=n.twice(),a?n=s?n.add(o):n.add(this):s&&(n=n.add(e)),--i}return n},Point.prototype.getEncoded=function(t){if(null==t&&(t=this.compressed),this.curve.isInfinity(this))return __Buffer_270.alloc(1,0);var e,r=this.affineX,i=this.affineY,n=this.curve.pLength;return t?(e=__Buffer_270.allocUnsafe(1+n)).writeUInt8(i.isEven()?2:3,0):((e=__Buffer_270.allocUnsafe(1+n+n)).writeUInt8(4,0),i.toBuffer(n).copy(e,1+n)),r.toBuffer(n).copy(e,1),e},Point.decodeFrom=function(t,e){var r,i=e.readUInt8(0),n=4!==i,o=Math.floor((t.p.bitLength()+7)/8),a=_$lib_166.fromBuffer(e.slice(1,1+o));if(n){var s=3===i;r=t.pointFromX(s,a)}else{var u=_$lib_166.fromBuffer(e.slice(1+o));r=Point.fromAffine(t,a,u)}return r.compressed=n,r},Point.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"},_$point_270=Point;var _$curve_266={};function Curve(t,e,r,i,n,o,a){this.p=t,this.a=e,this.b=r,this.G=_$point_270.fromAffine(this,i,n),this.n=o,this.h=a,this.infinity=new _$point_270(this,null,null,_$lib_166.ZERO),this.pOverFour=t.add(_$lib_166.ONE).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}Curve.prototype.pointFromX=function(t,e){var r=e.pow(3).add(this.a.multiply(e)).add(this.b).mod(this.p).modPow(this.pOverFour,this.p),i=r;return r.isEven()^!t&&(i=this.p.subtract(i)),_$point_270.fromAffine(this,e,i)},Curve.prototype.isInfinity=function(t){return t===this.infinity||0===t.z.signum()&&0!==t.y.signum()},Curve.prototype.isOnCurve=function(t){if(this.isInfinity(t))return!0;var e=t.affineX,r=t.affineY,i=this.a,n=this.b,o=this.p;if(e.signum()<0||e.compareTo(o)>=0)return!1;if(r.signum()<0||r.compareTo(o)>=0)return!1;var a=r.square().mod(o),s=e.pow(3).add(i.multiply(e)).add(n).mod(o);return a.equals(s)},Curve.prototype.validate=function(t){return t.multiply(this.n),!0},_$curve_266=Curve;var _$curves_267={secp128r1:{p:"fffffffdffffffffffffffffffffffff",a:"fffffffdfffffffffffffffffffffffc",b:"e87579c11079f43dd824993c2cee5ed3",n:"fffffffe0000000075a30d1b9038a115",h:"01",Gx:"161ff7528b899b2d0c28607ca52c5b86",Gy:"cf5ac8395bafeb13c02da292dded7a83"},secp160k1:{p:"fffffffffffffffffffffffffffffffeffffac73",a:"00",b:"07",n:"0100000000000000000001b8fa16dfab9aca16b6b3",h:"01",Gx:"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",Gy:"938cf935318fdced6bc28286531733c3f03c4fee"},secp160r1:{p:"ffffffffffffffffffffffffffffffff7fffffff",a:"ffffffffffffffffffffffffffffffff7ffffffc",b:"1c97befc54bd7a8b65acf89f81d4d4adc565fa45",n:"0100000000000000000001f4c8f927aed3ca752257",h:"01",Gx:"4a96b5688ef573284664698968c38bb913cbfc82",Gy:"23a628553168947d59dcc912042351377ac5fb32"},secp192k1:{p:"fffffffffffffffffffffffffffffffffffffffeffffee37",a:"00",b:"03",n:"fffffffffffffffffffffffe26f2fc170f69466a74defd8d",h:"01",Gx:"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",Gy:"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"},secp192r1:{p:"fffffffffffffffffffffffffffffffeffffffffffffffff",a:"fffffffffffffffffffffffffffffffefffffffffffffffc",b:"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",n:"ffffffffffffffffffffffff99def836146bc9b1b4d22831",h:"01",Gx:"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",Gy:"07192b95ffc8da78631011ed6b24cdd573f977a11e794811"},secp256k1:{p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"},secp256r1:{p:"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",a:"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",b:"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",n:"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",h:"01",Gx:"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",Gy:"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"}},_$names_269=function(t){var e=_$curves_267[t];if(!e)return null;var r=new _$lib_166(e.p,16),i=new _$lib_166(e.a,16),n=new _$lib_166(e.b,16),o=new _$lib_166(e.n,16),a=new _$lib_166(e.h,16),s=new _$lib_166(e.Gx,16),u=new _$lib_166(e.Gy,16);return new _$curve_266(r,i,n,s,u,o,a)},_$lib_268={Point:_$point_270,getCurveByName:_$names_269},_$legacy_227={},__Buffer_227=_$safeBuffer_345.Buffer,ZEROS=__Buffer_227.alloc(128),blocksize=64;function Hmac(t,e){_$cipherBase_223.call(this,"digest"),"string"==typeof e&&(e=__Buffer_227.from(e)),this._alg=t,this._key=e,e.length>blocksize?e=t(e):e.lengthr?e=("rmd160"===t?new _$ripemd160_344:_$shaJs_358(t)).update(e).digest():e.length=0||!r(a);)n=_$browser_226("sha256",n).update(o).update(ZERO).digest(),o=_$browser_226("sha256",n).update(o).digest(),o=_$browser_226("sha256",n).update(o).digest(),a=_$lib_166.fromBuffer(o);return a}},__secp256k1_44=_$lib_268.getCurveByName("secp256k1"),deterministicGenerateK=_$rfc6979_50.deterministicGenerateK,N_OVER_TWO=__secp256k1_44.n.shiftRight(1),_$ecdsa_44={sign:function(t,e){_$typeforce_388(_$types_78.tuple(_$types_78.Hash256bit,_$types_78.BigInt),arguments);var r,i,n=e.toBuffer(32),o=_$lib_166.fromBuffer(t),a=__secp256k1_44.n,s=__secp256k1_44.G;return deterministicGenerateK(t,n,(function(t){var n=s.multiply(t);return!__secp256k1_44.isInfinity(n)&&0!==(r=n.affineX.mod(a)).signum()&&0!==(i=t.modInverse(a).multiply(o.add(e.multiply(r))).mod(a)).signum()})),i.compareTo(N_OVER_TWO)>0&&(i=a.subtract(i)),new _$ecsignature_46(r,i)},verify:function(t,e,r){_$typeforce_388(_$types_78.tuple(_$types_78.Hash256bit,_$types_78.ECSignature,_$types_78.ECPoint),arguments);var i=__secp256k1_44.n,n=__secp256k1_44.G,o=e.r,a=e.s;if(o.signum()<=0||o.compareTo(i)>=0)return!1;if(a.signum()<=0||a.compareTo(i)>=0)return!1;var s=_$lib_166.fromBuffer(t),u=a.modInverse(i),h=s.multiply(u).mod(i),f=o.multiply(u).mod(i),c=n.multiplyTwo(h,r,f);return!__secp256k1_44.isInfinity(c)&&c.affineX.mod(i).equals(o)},__curve:__secp256k1_44},_$schnorr_51={};(function(t){var e=_$lib_268.getCurveByName("secp256k1"),r=_$rfc6979_50.deterministicGenerateK;function i(t,e){return t.modPow(e.subtract(_$lib_166.ONE).divide(_$lib_166.valueOf(2)),e).intValue()}function n(e){return _$typeforce_388(_$types_78.tuple(_$types_78.ECPoint),arguments),t.concat([t.from([e.affineY.isEven()?2:3]),e.affineX.toBuffer(32)])}_$schnorr_51={sign:function(o,a){_$typeforce_388(_$types_78.tuple(_$types_78.BufferN(32),_$types_78.BigInt),arguments);var s=e.n,u=e.G;if(a.compareTo(_$lib_166.ZERO)<=0||a.compareTo(s)>=0)throw new Error("Private key x not in range");var h,f,c=u.multiply(a);function l(r){var l=u.multiply(r);1!=i(l.affineY,e.p)&&(r=s.subtract(r),l=u.multiply(r)),h=l.affineX.mod(s);var _=n(c),d=h.toBuffer(32),p=_$crypto_43.sha256(t.concat([d,_,o])),m=_$lib_166.fromBuffer(p).mod(s);return f=r.add(m.multiply(a)).mod(s),!0}return r(o,a.toBuffer(32),l,t.from("Schnorr+SHA256 ","ascii")),new _$ecsignature_46(h,f)}}}).call(this,_$buffer_460({}).Buffer);var _$browser_342={};(function(t,e){"use strict";var r=_$safeBuffer_345.Buffer,i=e.crypto||e.msCrypto;_$browser_342=i&&i.getRandomValues?function(e,n){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a=0)throw new Error("Private key must be less than the curve order");if(e)throw new TypeError("Unexpected publicKey parameter");this.d=t}else _$typeforce_388(_$types_78.ECPoint,e),this.__Q=e;this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||_$networks_49.bitcoin}Object.defineProperty(ECPair.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=__secp256k1_45.G.multiply(this.d)),this.__Q}}),ECPair.fromPublicKeyBuffer=function(t,e){var r=_$lib_268.Point.decodeFrom(__secp256k1_45,t);return new ECPair(null,r,{compressed:r.compressed,network:e})},ECPair.fromWIF=function(t,e){var r=_$wif_393.decode(t),i=r.version;if(_$types_78.Array(e)){if(!(e=e.filter((function(t){return i===t.wif})).pop()))throw new Error("Unknown network version")}else if(e=e||_$networks_49.bitcoin,i!==e.wif)throw new Error("Invalid network version");return new ECPair(_$lib_166.fromBuffer(r.privateKey),null,{compressed:r.compressed,network:e})},ECPair.makeRandom=function(t){var e,r=(t=t||{}).rng||_$browser_342;do{var i=r(32);_$typeforce_388(_$types_78.Buffer256bit,i),e=_$lib_166.fromBuffer(i)}while(e.signum()<=0||e.compareTo(__secp256k1_45.n)>=0);return new ECPair(e,null,t)},ECPair.prototype.getAddress=function(){return _$address_40.toBase58Check(_$crypto_43.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},ECPair.prototype.getNetwork=function(){return this.network},ECPair.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},ECPair.prototype.sign=function(t,e){if(!this.d)throw new Error("Missing private key");return e||(e=_$ecsignature_46.ECDSA),e===_$ecsignature_46.ECDSA?_$ecdsa_44.sign(t,this.d):e===_$ecsignature_46.SCHNORR?_$schnorr_51.sign(t,this.d):void 0},ECPair.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return _$wif_393.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},ECPair.prototype.verify=function(t,e){return _$ecdsa_44.verify(t,e,this.Q)},_$ecpair_45=ECPair;var _$hdnode_47={},__Buffer_47=_$safeBuffer_345.Buffer,curve=_$lib_268.getCurveByName("secp256k1");function HDNode(t,e){if(!t.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=t,this.chainCode=e,this.depth=0,this.index=0,this.parentFingerprint=0}HDNode.HIGHEST_BIT=2147483648,HDNode.LENGTH=78,HDNode.MASTER_SECRET=__Buffer_47.from("Bitcoin seed","utf8"),HDNode.fromSeedBuffer=function(t,e){if(_$typeforce_388(_$types_78.tuple(_$types_78.Buffer,_$types_78.maybe(_$types_78.Network)),arguments),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");var r=_$browser_226("sha512",HDNode.MASTER_SECRET).update(t).digest(),i=r.slice(0,32),n=r.slice(32),o=_$lib_166.fromBuffer(i);return new HDNode(new _$ecpair_45(o,null,{network:e}),n)},HDNode.fromSeedHex=function(t,e){return HDNode.fromSeedBuffer(__Buffer_47.from(t,"hex"),e)},HDNode.fromBase58=function(t,e){var r=_$bs58check_210.decode(t);if(78!==r.length)throw new Error("Invalid buffer length");var i,n=r.readUInt32BE(0);if(Array.isArray(e)){if(!(i=e.filter((function(t){return n===t.bip32.private||n===t.bip32.public})).pop()))throw new Error("Unknown network version")}else i=e||_$networks_49.bitcoin;if(n!==i.bip32.private&&n!==i.bip32.public)throw new Error("Invalid network version");var o=r[4],a=r.readUInt32BE(5);if(0===o&&0!==a)throw new Error("Invalid parent fingerprint");var s=r.readUInt32BE(9);if(0===o&&0!==s)throw new Error("Invalid index");var u,h=r.slice(13,45);if(n===i.bip32.private){if(0!==r.readUInt8(45))throw new Error("Invalid private key");var f=_$lib_166.fromBuffer(r.slice(46,78));u=new _$ecpair_45(f,null,{network:i})}else{var c=_$lib_268.Point.decodeFrom(curve,r.slice(45,78));curve.validate(c),u=new _$ecpair_45(null,c,{network:i})}var l=new HDNode(u,h);return l.depth=o,l.index=s,l.parentFingerprint=a,l},HDNode.prototype.getAddress=function(){return this.keyPair.getAddress()},HDNode.prototype.getIdentifier=function(){return _$crypto_43.hash160(this.keyPair.getPublicKeyBuffer())},HDNode.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},HDNode.prototype.getNetwork=function(){return this.keyPair.getNetwork()},HDNode.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},HDNode.prototype.neutered=function(){var t=new HDNode(new _$ecpair_45(null,this.keyPair.Q,{network:this.keyPair.network}),this.chainCode);return t.depth=this.depth,t.index=this.index,t.parentFingerprint=this.parentFingerprint,t},HDNode.prototype.sign=function(t){return this.keyPair.sign(t)},HDNode.prototype.verify=function(t,e){return this.keyPair.verify(t,e)},HDNode.prototype.toBase58=function(t){if(void 0!==t)throw new TypeError("Unsupported argument in 2.0.0");var e=this.keyPair.network,r=this.isNeutered()?e.bip32.public:e.bip32.private,i=__Buffer_47.allocUnsafe(78);return i.writeUInt32BE(r,0),i.writeUInt8(this.depth,4),i.writeUInt32BE(this.parentFingerprint,5),i.writeUInt32BE(this.index,9),this.chainCode.copy(i,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(i,45):(i.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(i,46)),_$bs58check_210.encode(i)},HDNode.prototype.derive=function(t){_$typeforce_388(_$types_78.UInt32,t);var e=t>=HDNode.HIGHEST_BIT,r=__Buffer_47.allocUnsafe(37);if(e){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");r[0]=0,this.keyPair.d.toBuffer(32).copy(r,1),r.writeUInt32BE(t,33)}else this.keyPair.getPublicKeyBuffer().copy(r,0),r.writeUInt32BE(t,33);var i,n=_$browser_226("sha512",this.chainCode).update(r).digest(),o=n.slice(0,32),a=n.slice(32),s=_$lib_166.fromBuffer(o);if(s.compareTo(curve.n)>=0)return this.derive(t+1);if(this.isNeutered()){var u=curve.G.multiply(s).add(this.keyPair.Q);if(curve.isInfinity(u))return this.derive(t+1);i=new _$ecpair_45(null,u,{network:this.keyPair.network})}else{var h=s.add(this.keyPair.d).mod(curve.n);if(0===h.signum())return this.derive(t+1);i=new _$ecpair_45(h,null,{network:this.keyPair.network})}var f=new HDNode(i,a);return f.depth=this.depth+1,f.index=t,f.parentFingerprint=this.getFingerprint().readUInt32BE(0),f},HDNode.prototype.deriveHardened=function(t){return _$typeforce_388(_$types_78.UInt31,t),this.derive(t+HDNode.HIGHEST_BIT)},HDNode.prototype.isNeutered=function(){return!this.keyPair.d},HDNode.prototype.derivePath=function(t){_$typeforce_388(_$types_78.BIP32Path,t);var e=t.split("/");if("m"===e[0]){if(this.parentFingerprint)throw new Error("Not a master node");e=e.slice(1)}return e.reduce((function(t,e){var r;return"'"===e.slice(-1)?(r=parseInt(e.slice(0,-1),10),t.deriveHardened(r)):(r=parseInt(e,10),t.derive(r))}),this)},_$hdnode_47=HDNode;var __Buffer_392=_$safeBuffer_345.Buffer,MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(t){if(t<0||t>MAX_SAFE_INTEGER||t%1!=0)throw new RangeError("value out of range")}function __encodingLength_392(t){return checkUInt53(t),t<253?1:t<=65535?3:t<=4294967295?5:9}var _$varuintBitcoin_392={encode:function t(e,r,i){if(checkUInt53(e),r||(r=__Buffer_392.allocUnsafe(__encodingLength_392(e))),!__Buffer_392.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),e<253?(r.writeUInt8(e,i),t.bytes=1):e<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(e,i+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(e,i+1),t.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(e>>>0,i+1),r.writeUInt32LE(e/4294967296|0,i+5),t.bytes=9),r},decode:function t(e,r){if(!__Buffer_392.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=e.readUInt8(r);if(i<253)return t.bytes=1,i;if(253===i)return t.bytes=3,e.readUInt16LE(r+1);if(254===i)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var n=e.readUInt32LE(r+1),o=4294967296*e.readUInt32LE(r+5)+n;return checkUInt53(o),o},encodingLength:__encodingLength_392};function verifuint(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}var _$bufferutils_42={pushDataSize:_$pushdataBitcoin_97.encodingLength,readPushDataInt:_$pushdataBitcoin_97.decode,readUInt64LE:function(t,e){var r=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return verifuint((i*=4294967296)+r,9007199254740991),i+r},readVarInt:function(t,e){return{number:_$varuintBitcoin_392.decode(t,e),size:_$varuintBitcoin_392.decode.bytes}},varIntBuffer:_$varuintBitcoin_392.encode,varIntSize:_$varuintBitcoin_392.encodingLength,writePushDataInt:_$pushdataBitcoin_97.encode,writeUInt64LE:function(t,e,r){return verifuint(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8},writeVarInt:function(t,e,r){return _$varuintBitcoin_392.encode(e,t,r),_$varuintBitcoin_392.encode.bytes}},_$transaction_76={},__Buffer_76=_$safeBuffer_345.Buffer;function varSliceSize(t){var e=t.length;return _$varuintBitcoin_392.encodingLength(e)+e}function Transaction(){this.version=2,this.locktime=0,this.ins=[],this.outs=[]}Transaction.DEFAULT_SEQUENCE=4294967295,Transaction.SIGHASH_ALL=1,Transaction.SIGHASH_NONE=2,Transaction.SIGHASH_SINGLE=3,Transaction.SIGHASH_ANYONECANPAY=128,Transaction.SIGHASH_BITCOINCASHBIP143=64,Transaction.ADVANCED_TRANSACTION_MARKER=0,Transaction.ADVANCED_TRANSACTION_FLAG=1;var EMPTY_SCRIPT=__Buffer_76.allocUnsafe(0),EMPTY_WITNESS=[],__ZERO_76=__Buffer_76.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),__ONE_76=__Buffer_76.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=__Buffer_76.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_SCRIPT,valueBuffer:VALUE_UINT64_MAX};Transaction.fromBuffer=function(t,e){var r=0;function i(e){return r+=e,t.slice(r-e,r)}function n(){var e=t.readUInt32LE(r);return r+=4,e}function o(){var e=_$bufferutils_42.readUInt64LE(t,r);return r+=8,e}function a(){var e=_$varuintBitcoin_392.decode(t,r);return r+=_$varuintBitcoin_392.decode.bytes,e}function s(){return i(a())}function u(){for(var t=a(),e=[],r=0;r=this.ins.length)return __ONE_76;var i=_$script_52.compile(_$script_52.decompile(e).filter((function(t){return t!==_$index_38.OP_CODESEPARATOR}))),n=this.clone();if((31&r)===Transaction.SIGHASH_NONE)n.outs=[],n.ins.forEach((function(e,r){r!==t&&(e.sequence=0)}));else if((31&r)===Transaction.SIGHASH_SINGLE){if(t>=this.outs.length)return __ONE_76;n.outs.length=t+1;for(var o=0;o0)return e=e.map((function(t){return t||_$index_38.OP_0})),i||(e=e.filter((function(t){return t!==_$index_38.OP_0}))),_$templates_54.multisig.input.encodeStack(e)}if(!i)throw new Error("Not enough signatures provided");return[]}function TransactionBuilder(t,e){this.prevTxMap={},this.network=t||_$networks_49.bitcoin,this.maximumFeeRate=e||2500,this.inputs=[],this.bitcoinCash=!0,this.tx=new _$transaction_76}function canSign(t){return void 0!==t.prevOutScript&&void 0!==t.signScript&&void 0!==t.pubKeys&&void 0!==t.signatures&&t.signatures.length===t.pubKeys.length&&t.pubKeys.length>0&&(!1===t.witness||!0===t.witness&&void 0!==t.value)}function signatureHashType(t){return t.readUInt8(t.length-1)}TransactionBuilder.prototype.setLockTime=function(t){if(_$typeforce_388(_$types_78.UInt32,t),this.inputs.some((function(t){return!!t.signatures&&t.signatures.some((function(t){return t}))})))throw new Error("No, this would invalidate signatures");this.tx.locktime=t},TransactionBuilder.fromTransaction=function(t,e,r){var i=new TransactionBuilder(e);return i.setLockTime(t.locktime),t.outs.forEach((function(t){i.addOutput(t.script,t.value)})),t.ins.forEach((function(t){i.__addInputUnsafe(t.hash,t.index,{sequence:t.sequence,script:t.script,witness:t.witness,value:t.value})})),i.inputs.forEach((function(e,i){!function(t,e,r,i,n){if(t.redeemScriptType===scriptTypes.MULTISIG&&t.redeemScript&&t.pubKeys.length!==t.signatures.length){var o=t.signatures.concat();t.signatures=t.pubKeys.map((function(a){var s,u=_$ecpair_45.fromPublicKeyBuffer(a);return o.some((function(a,h){if(!a)return!1;var f,c=_$ecsignature_46.parseScriptSignature(a);return f=n?e.hashForCashSignature(r,t.signScript,i,c.hashType):t.witness?e.hashForWitnessV0(r,t.signScript,i,c.hashType):e.hashForSignature(r,t.signScript,c.hashType),!!u.verify(f,c.signature)&&(o[h]=void 0,s=a,!0)})),s}))}}(e,t,i,e.value,r)})),i},TransactionBuilder.prototype.addInput=function(t,e,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var n;if("string"==typeof t)t=__Buffer_77.from(t,"hex").reverse();else if(t instanceof _$transaction_76){var o=t.outs[e];i=o.script,n=o.value,t=t.getHash()}return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:n})},TransactionBuilder.prototype.__addInputUnsafe=function(t,e,r){if(_$transaction_76.isCoinbaseHash(t))throw new Error("coinbase inputs not supported");var i=t.toString("hex")+":"+e;if(void 0!==this.prevTxMap[i])throw new Error("Duplicate TxOut: "+i);var n={};if(void 0!==r.script&&(n=expandInput(r.script,r.witness||[])),void 0!==r.value&&(n.value=r.value),!n.prevOutScript&&r.prevOutScript){var o;if(!n.pubKeys&&!n.signatures){var a=expandOutput(r.prevOutScript);a.pubKeys&&(n.pubKeys=a.pubKeys,n.signatures=a.signatures),o=a.scriptType}n.prevOutScript=r.prevOutScript,n.prevOutType=o||_$templates_54.classifyOutput(r.prevOutScript)}var s=this.tx.addInput(t,e,r.sequence,r.scriptSig);return this.inputs[s]=n,this.prevTxMap[i]=s,s},TransactionBuilder.prototype.addOutput=function(t,e){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof t&&(t=_$address_40.toOutputScript(t,this.network)),this.tx.addOutput(t,e)},TransactionBuilder.prototype.build=function(){return this.__build(!1)},TransactionBuilder.prototype.buildIncomplete=function(){return this.__build(!0)},TransactionBuilder.prototype.__build=function(t){if(!t){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var e=this.tx.clone();if(this.inputs.forEach((function(r,i){if(!(r.witnessScriptType||r.redeemScriptType||r.prevOutType||t))throw new Error("Transaction is not complete");var n=function(t,e){var r=t.prevOutType,i=[],n=[];supportedType(r)&&(i=buildStack(r,t.signatures,t.pubKeys,e));var o=!1;if(r===_$templates_54.types.P2SH){if(!e&&!supportedP2SHType(t.redeemScriptType))throw new Error("Impossible to sign this type");supportedType(t.redeemScriptType)&&(i=buildStack(t.redeemScriptType,t.signatures,t.pubKeys,e)),t.redeemScriptType&&(o=!0,r=t.redeemScriptType)}switch(r){case _$templates_54.types.P2WPKH:n=buildStack(_$templates_54.types.P2PKH,t.signatures,t.pubKeys,e);break;case _$templates_54.types.P2WSH:if(!e&&!supportedType(t.witnessScriptType))throw new Error("Impossible to sign this type");supportedType(t.witnessScriptType)&&((n=buildStack(t.witnessScriptType,t.signatures,t.pubKeys,e)).push(t.witnessScript),r=t.witnessScriptType)}return o&&i.push(t.redeemScript),{type:r,script:_$script_52.compile(i),witness:n}}(r,t);if(!t&&!supportedType(n.type)&&n.type!==_$templates_54.types.P2WPKH)throw new Error(n.type+" not supported");e.setInputScript(i,n.script),e.setWitness(i,n.witness)})),!t&&this.__overMaximumFees(e.virtualSize()))throw new Error("Transaction has absurd fees");return e},TransactionBuilder.prototype.sign=function(t,e,r,i,n,o,a){if(i|=_$transaction_76.SIGHASH_BITCOINCASHBIP143,!this.inputs[t])throw new Error("No input at index: "+t);i=i||_$transaction_76.SIGHASH_ALL;var s=this.inputs[t];if(void 0!==s.redeemScript&&r&&!s.redeemScript.equals(r))throw new Error("Inconsistent redeemScript");var u=e.publicKey||e.getPublicKeyBuffer();if(!canSign(s)){if(void 0!==n){if(void 0!==s.value&&s.value!==n)throw new Error("Input didn't match witnessValue");_$typeforce_388(_$types_78.Satoshi,n),s.value=n}if(canSign(s)||prepareInput(s,u,r,0,o),!canSign(s))throw Error(s.prevOutType+" not supported")}var h=this.tx.hashForCashSignature(t,s.signScript,n,i);if(!s.pubKeys.some((function(t,r){if(!u.equals(t))return!1;if(s.signatures[r])throw new Error("Signature already exists");if(33!==u.length&&s.signType===scriptTypes.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");var n=e.sign(h,a);return __Buffer_77.isBuffer(n)&&(n=_$ecsignature_46.fromRSBuffer(n)),s.signatures[r]=n.toScriptSignature(i,a),!0})))throw new Error("Key pair cannot sign for this input")},TransactionBuilder.prototype.__canModifyInputs=function(){return this.inputs.every((function(t){return void 0===t.signatures||t.signatures.every((function(t){return!t||signatureHashType(t)&_$transaction_76.SIGHASH_ANYONECANPAY}))}))},TransactionBuilder.prototype.__canModifyOutputs=function(){var t=this.tx.ins.length,e=this.tx.outs.length;return this.inputs.every((function(r){return void 0===r.signatures||r.signatures.every((function(r){if(!r)return!0;var i=31&signatureHashType(r);return i===_$transaction_76.SIGHASH_NONE||(i===_$transaction_76.SIGHASH_SINGLE?t<=e:void 0)}))}))},TransactionBuilder.prototype.__overMaximumFees=function(t){return(this.inputs.reduce((function(t,e){return t+(e.value>>>0)}),0)-this.tx.outs.reduce((function(t,e){return t+e.value}),0))/t>this.maximumFeeRate},_$transaction_builder_77=TransactionBuilder;var _$fastRoot_322={};(function(t){_$fastRoot_322=function(e,r){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof r)throw TypeError("Expected digest Function");for(var i=e.length,n=e.concat();i>1;){for(var o=0,a=0;a>24)-3,r=8388607&t,i=__Buffer_41.alloc(32,0);return i.writeUInt32BE(r,28-e),i},Block.calculateMerkleRoot=function(t){if(_$typeforce_388([{getHash:_$types_78.Function}],t),0===t.length)throw TypeError("Cannot compute merkle root for zero transactions");var e=t.map((function(t){return t.getHash()}));return _$fastRoot_322(e,_$crypto_43.hash256)},Block.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var t=Block.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)},Block.prototype.checkProofOfWork=function(){var t=this.getHash().reverse(),e=Block.calculateTarget(this.bits);return t.compare(e)<=0},_$block_41=Block,_$templates_54)_$script_52[key]=_$templates_54[key];var _$src_48={ECPair:_$ecpair_45,ECSignature:_$ecsignature_46,HDNode:_$hdnode_47,TransactionBuilder:_$transaction_builder_77,address:_$address_40,crypto:_$crypto_43,networks:_$networks_49,script:_$script_52},_$big_163={exports:{}};!function(t){"use strict";var e,r={},i=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function n(t,e,r){var i=t.constructor,n=e-(t=new i(t)).e,a=t.c;for(a.length>++e&&o(t,n,i.RM),a[0]?r?n=e:(a=t.c,n=t.e+n+1):++n;a.length1?a[0]+"."+a.join("").slice(1):a[0])+(n<0?"e":"e+")+n:t.toString()}function o(t,e,r,i){var n,o=t.c,s=t.e+e+1;if(1===r?i=o[s]>=5:2===r?i=o[s]>5||5==o[s]&&(i||s<0||o[s+1]!==n||1&o[s-1]):3===r?i=i||o[s]!==n||s<0:(i=!1,0!==r&&a("!Big.RM!")),s<1||!o[0])i?(t.e=-e,t.c=[1]):t.c=[t.e=0];else{if(o.length=s--,i)for(;++o[s]>9;)o[s]=0,s--||(++t.e,o.unshift(1));for(s=o.length;!o[--s];o.pop());}return t}function a(t){var e=new Error(t);throw e.name="BigError",e}r.abs=function(){var t=new this.constructor(this);return t.s=1,t},r.cmp=function(t){var e,r=this,i=r.c,n=(t=new r.constructor(t)).c,o=r.s,a=t.s,s=r.e,u=t.e;if(!i[0]||!n[0])return i[0]?o:n[0]?-a:0;if(o!=a)return o;if(e=o<0,s!=u)return s>u^e?1:-1;for(o=-1,a=(s=i.length)<(u=n.length)?s:u;++on[o]^e?1:-1;return s==u?0:s>u^e?1:-1},r.div=function(t){var e=this,r=e.constructor,i=e.c,n=(t=new r(t)).c,s=e.s==t.s?1:-1,u=r.DP;if((u!==~~u||u<0||u>1e6)&&a("!Big.DP!"),!i[0]||!n[0])return i[0]==n[0]&&a(NaN),n[0]||a(s/0),new r(0*s);var h,f,c,l,_,d,p=n.slice(),m=h=n.length,b=i.length,g=i.slice(0,h),v=g.length,y=t,w=y.c=[],M=0,S=u+(y.e=e.e-t.e)+1;for(y.s=s,s=S<0?0:S,p.unshift(0);v++v?1:-1;else for(_=-1,l=0;++_g[_]?1:-1;break}if(!(l<0))break;for(f=v==h?n:p;v;){if(g[--v]S&&o(y,u,r.RM,g[0]!==d),y},r.eq=function(t){return!this.cmp(t)},r.gt=function(t){return this.cmp(t)>0},r.gte=function(t){return this.cmp(t)>-1},r.lt=function(t){return this.cmp(t)<0},r.lte=function(t){return this.cmp(t)<1},r.sub=r.minus=function(t){var e,r,i,n,o=this,a=o.constructor,s=o.s,u=(t=new a(t)).s;if(s!=u)return t.s=-u,o.plus(t);var h=o.c.slice(),f=o.e,c=t.c,l=t.e;if(!h[0]||!c[0])return c[0]?(t.s=-u,t):new a(h[0]?o:0);if(s=f-l){for((n=s<0)?(s=-s,i=h):(l=f,i=c),i.reverse(),u=s;u--;i.push(0));i.reverse()}else for(r=((n=h.length0)for(;u--;h[e++]=0);for(u=e;r>s;){if(h[--r]0?(u=a,e=h):(n=-n,e=s),e.reverse();n--;e.push(0));e.reverse()}for(s.length-h.length<0&&(e=h,h=s,s=e),n=h.length,o=0;n;)o=(s[--n]=s[n]+h[n]+o)/10|0,s[n]%=10;for(o&&(s.unshift(o),++u),n=s.length;0===s[--n];s.pop());return t.c=s,t.e=u,t},r.pow=function(t){var e=this,r=new e.constructor(1),i=r,n=t<0;for((t!==~~t||t<-1e6||t>1e6)&&a("!pow!"),t=n?-t:t;1&t&&(i=i.times(e)),t>>=1;)e=e.times(e);return n?r.div(i):i},r.round=function(t,e){var r=this,i=r.constructor;return null==t?t=0:(t!==~~t||t<0||t>1e6)&&a("!round!"),o(r=new i(r),t,null==e?i.RM:e),r},r.sqrt=function(){var t,e,r,i=this,n=i.constructor,s=i.c,u=i.s,h=i.e,f=new n("0.5");if(!s[0])return new n(i);u<0&&a(NaN),0===(u=Math.sqrt(i.toString()))||u===1/0?((t=s.join("")).length+h&1||(t+="0"),(e=new n(Math.sqrt(t).toString())).e=((h+1)/2|0)-(h<0||1&h)):e=new n(u.toString()),u=e.e+(n.DP+=4);do{r=e,e=f.times(r.plus(i.div(r)))}while(r.c.slice(0,u).join("")!==e.c.slice(0,u).join(""));return o(e,n.DP-=4,n.RM),e},r.mul=r.times=function(t){var e,r=this,i=r.constructor,n=r.c,o=(t=new i(t)).c,a=n.length,s=o.length,u=r.e,h=t.e;if(t.s=r.s==t.s?1:-1,!n[0]||!o[0])return new i(0*t.s);for(t.e=u+h,au;)s=e[h]+o[u]*n[h-u-1]+s,e[h--]=s%10,s=s/10|0;e[h]=(e[h]+s)%10}for(s&&++t.e,e[0]||e.shift(),u=e.length;!e[--u];e.pop());return t.c=e,t},r.toString=r.valueOf=r.toJSON=function(){var t=this,e=t.constructor,r=t.e,i=t.c.join(""),n=i.length;if(r<=e.E_NEG||r>=e.E_POS)i=i.charAt(0)+(n>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;i="0"+i);i="0."+i}else if(r>0)if(++r>n)for(r-=n;r--;i+="0");else r1&&(i=i.charAt(0)+"."+i.slice(1));return t.s<0&&t.c[0]?"-"+i:i},r.toExponential=function(t){return null==t?t=this.c.length-1:(t!==~~t||t<0||t>1e6)&&a("!toExp!"),n(this,t,1)},r.toFixed=function(t){var e,r=this,i=r.constructor,o=i.E_NEG,s=i.E_POS;return i.E_NEG=-(i.E_POS=1/0),null==t?e=r.toString():t===~~t&&t>=0&&t<=1e6&&(e=n(r,r.e+t),r.s<0&&r.c[0]&&e.indexOf("-")<0&&(e="-"+e)),i.E_NEG=o,i.E_POS=s,e||a("!toFix!"),e},r.toPrecision=function(t){return null==t?this.toString():((t!==~~t||t<1||t>1e6)&&a("!toPre!"),n(this,t-1,2))},e=function t(){function e(r){var n=this;if(!(n instanceof e))return void 0===r?t():new e(r);r instanceof e?(n.s=r.s,n.e=r.e,n.c=r.c.slice()):function(t,e){var r,n,o;for(0===e&&1/e<0?e="-0":i.test(e+="")||a(NaN),t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[];n<=o;t.c.push(+e.charAt(n++)));}}(n,r),n.constructor=e}return e.prototype=r,e.DP=20,e.RM=1,e.E_NEG=-7,e.E_POS=21,e}(),"function"==typeof define&&define.amd?define((function(){return e})):_$big_163.exports?(_$big_163.exports=e,_$big_163.exports.Big=e):t.Big=e}(this),_$big_163=_$big_163.exports;var _$satoshiBitcoin_346={};function toNumber(t){return Number(t)}Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&t%1==0}),_$satoshiBitcoin_346={toBitcoin:function(t){var e=typeof t;if("string"===e&&(t=toNumber(t),e="number"),"number"!==e)throw new TypeError("toBitcoin must be called on a number or string, got "+e);if(!Number.isInteger(t))throw new TypeError("toBitcoin must be called on a whole number or string format whole number");var r=new _$big_163(t);return Number(r.div(1e8))},toSatoshi:function(t){var e=typeof t;if("string"===e&&(t=toNumber(t),e="number"),"number"!==e)throw new TypeError("toSatoshi must be called on a number or string, got "+e);var r=new _$big_163(t);return Number(r.times(1e8))}};var _$bufferEquals_211={};(function(t){"use strict";_$bufferEquals_211=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return!0;if("function"==typeof e.equals)return e.equals(r);if(e.length!==r.length)return!1;for(var i=0;i=r)throw RangeError(i)}}).call(this,{isBuffer:_$isBuffer_531});var _$der_353={},__Buffer_353=_$safeBuffer_345.Buffer,EC_PRIVKEY_EXPORT_DER_COMPRESSED=__Buffer_353.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]),EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=__Buffer_353.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]);_$der_353.privateKeyExport=function(t,e,r){var i=__Buffer_353.from(r?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);return t.copy(i,r?8:9),e.copy(i,r?181:214),i},_$der_353.privateKeyImport=function(t){var e=t.length,r=0;if(!(e2||e1?t[r+i-2]<<8:0);if(!(e<(r+=i)+n||e32||e1&&0===e[i]&&!(128&e[i+1]);--r,++i);for(var n=__Buffer_353.concat([__Buffer_353.from([0]),t.s]),o=33,a=0;o>1&&0===n[a]&&!(128&n[a+1]);--o,++a);return _$bip66_187.encode(e.slice(i),n.slice(a))},_$der_353.signatureImport=function(t){var e=__Buffer_353.alloc(32,0),r=__Buffer_353.alloc(32,0);try{var i=_$bip66_187.decode(t);if(33===i.r.length&&0===i.r[0]&&(i.r=i.r.slice(1)),i.r.length>32)throw new Error("R length is too long");if(33===i.s.length&&0===i.s[0]&&(i.s=i.s.slice(1)),i.s.length>32)throw new Error("S length is too long")}catch(err){return}return i.r.copy(e,32-i.r.length),i.s.copy(r,32-i.s.length),{r:e,s:r}},_$der_353.signatureImportLax=function(t){var e=__Buffer_353.alloc(32,0),r=__Buffer_353.alloc(32,0),i=t.length,n=0;if(48===t[n++]){var o=t[n++];if(!(128&o&&(n+=o-128)>i)&&2===t[n++]){var a=t[n++];if(128&a){if(n+(o=a-128)>i)return;for(;o>0&&0===t[n];n+=1,o-=1);for(a=0;o>0;n+=1,o-=1)a=(a<<8)+t[n]}if(!(a>i-n)){var s=n;if(n+=a,2===t[n++]){var u=t[n++];if(128&u){if(n+(o=u-128)>i)return;for(;o>0&&0===t[n];n+=1,o-=1);for(u=0;o>0;n+=1,o-=1)u=(u<<8)+t[n]}if(!(u>i-n)){var h=n;for(n+=u;a>0&&0===t[s];a-=1,s+=1);if(!(a>32)){var f=t.slice(s,s+a);for(f.copy(e,32-f.length);u>0&&0===t[h];u-=1,h+=1);if(!(u>32)){var c=t.slice(h,h+u);return c.copy(r,32-c.length),{r:e,s:r}}}}}}}}};var _$messages_356={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"};function initCompressedValue(t,e){return void 0===t?e:(_$assert_352.isBoolean(t,_$messages_356.COMPRESSED_TYPE_INVALID),t)}var _$lib_355=function(t){return{privateKeyVerify:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),32===e.length&&t.privateKeyVerify(e)},privateKeyExport:function(e,r){_$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0);var i=t.privateKeyExport(e,r);return _$der_353.privateKeyExport(e,i,r)},privateKeyImport:function(e){if(_$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),(e=_$der_353.privateKeyImport(e))&&32===e.length&&t.privateKeyVerify(e))return e;throw new Error(_$messages_356.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyNegate(e)},privateKeyModInverse:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyModInverse(e)},privateKeyTweakAdd:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),t.privateKeyTweakAdd(e,r)},privateKeyTweakMul:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),t.privateKeyTweakMul(e,r)},publicKeyCreate:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0),t.publicKeyCreate(e,r)},publicKeyConvert:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_352.isBufferLength2(e,33,65,_$messages_356.EC_PUBLIC_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0),t.publicKeyConvert(e,r)},publicKeyVerify:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),t.publicKeyVerify(e)},publicKeyTweakAdd:function(e,r,i){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_352.isBufferLength2(e,33,65,_$messages_356.EC_PUBLIC_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),i=initCompressedValue(i,!0),t.publicKeyTweakAdd(e,r,i)},publicKeyTweakMul:function(e,r,i){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_352.isBufferLength2(e,33,65,_$messages_356.EC_PUBLIC_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),i=initCompressedValue(i,!0),t.publicKeyTweakMul(e,r,i)},publicKeyCombine:function(e,r){_$assert_352.isArray(e,_$messages_356.EC_PUBLIC_KEYS_TYPE_INVALID),_$assert_352.isLengthGTZero(e,_$messages_356.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=a(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return this.toArrayLike(n,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 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},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){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()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){return this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new i(1),o=new i(0),a=new i(0),s=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(f)),n.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(s)):(r.isub(e),a.isub(n),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},i.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new i(1),a=new i(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return this._forceRed(t)},i.prototype.redAdd=function(t){return this.red.add(this,t)},i.prototype.redIAdd=function(t){return this.red.iadd(this,t)},i.prototype.redSub=function(t){return this.red.sub(this,t)},i.prototype.redISub=function(t){return this.red.isub(this,t)},i.prototype.redShl=function(t){return this.red.shl(this,t)},i.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},r(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new i(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),n=0;!r.isZero()&&0===r.andln(1);)n++,r.iushrn(1);var o=new i(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=n;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new i(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n=0;n--){for(var h=e.words[n],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},r(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_189,this),_$bn_189=_$bn_189.exports;var _$package_286={version:"6.5.4"},_$minimalisticAssert_324={};function __assert_324(t,e){if(!t)throw new Error(e||"Assertion failed")}_$minimalisticAssert_324=__assert_324,__assert_324.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var _$utils_325={},utils=_$utils_325;function zero2(t){return 1===t.length?"0"+t:t}function toHex(t){for(var e="",r=0;r>8,a=255&n;o?r.push(o,a):r.push(a)}return r},utils.zero2=zero2,utils.toHex=toHex,utils.encode=function(t,e){return"hex"===e?toHex(t):t};var _$utils_285={},__utils_285=_$utils_285;__utils_285.assert=_$minimalisticAssert_324,__utils_285.toArray=_$utils_325.toArray,__utils_285.zero2=_$utils_325.zero2,__utils_285.toHex=_$utils_325.toHex,__utils_285.encode=_$utils_325.encode,__utils_285.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?(n>>1)-u:u,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},__utils_285.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+n&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),a=0==(1&u)?0:3!=(i=t.andln(7)+n&7)&&5!==i||2!==h?u:-u,r[0].push(a),s=0==(1&h)?0:3!=(i=e.andln(7)+o&7)&&5!==i||2!==u?h:-h,r[1].push(s),2*n===a+1&&(n=1-n),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},__utils_285.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},__utils_285.parseBytes=function(t){return"string"==typeof t?__utils_285.toArray(t,"hex"):t},__utils_285.intFromLE=function(t){return new _$bn_189(t,"hex","le")};var _$brorand_190={},r;function Rand(t){this.rand=t}if(_$brorand_190=function(t){return r||(r=new Rand(null)),r.generate(t)},_$brorand_190.Rand=Rand,Rand.prototype.generate=function(t){return this._rand(t)},Rand.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(t,e){this.curve=t,this.type=e,this.precomputed=null}_$utils_285.assert,_$base_272=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(t,e){var r=t._getDoubles(),i=getNAF(e,1,this._bitLength),n=(1<=o;u--)a=(a<<1)+i[u];s.push(a)}for(var h=this.jpoint(null,null,null),f=this.jpoint(null,null,null),c=n;c>0;c--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var h=o[s];a="affine"===t.type?h>0?a.mixedAdd(n[h-1>>1]):a.mixedAdd(n[-h-1>>1].neg()):h>0?a.add(n[h-1>>1]):a.add(n[-h-1>>1].neg())}return"affine"===t.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(t,e,r,i,n){var o,a,s,u=this._wnafT1,h=this._wnafT2,f=this._wnafT3,c=0;for(o=0;o=1;o-=2){var _=o-1,d=o;if(1===u[_]&&1===u[d]){var p=[e[_],null,null,e[d]];0===e[_].y.cmp(e[d].y)?(p[1]=e[_].add(e[d]),p[2]=e[_].toJ().mixedAdd(e[d].neg())):0===e[_].y.cmp(e[d].y.redNeg())?(p[1]=e[_].toJ().mixedAdd(e[d]),p[2]=e[_].add(e[d].neg())):(p[1]=e[_].toJ().mixedAdd(e[d]),p[2]=e[_].toJ().mixedAdd(e[d].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=getJSF(r[_],r[d]);for(c=Math.max(b[0].length,c),f[_]=new Array(c),f[d]=new Array(c),a=0;a=0;o--){for(var M=0;o>=0;){var S=!0;for(a=0;a=0&&M++,y=y.dblp(M),o<0)break;for(a=0;a0?s=h[a][$-1>>1]:$<0&&(s=h[a][-$-1>>1].neg()),y="affine"===s.type?y.mixedAdd(s):y.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},BasePoint.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n=0&&(o=e,a=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:n},{a:o,b:a}]},ShortCurve.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),h=o.mul(i.b);return{k1:t.sub(a).sub(s),k2:u.add(h).neg()}},ShortCurve.prototype.pointFromX=function(t,e){(t=new _$bn_189(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},ShortCurve.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},__Point_276.prototype.isInfinity=function(){return this.inf},__Point_276.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},__Point_276.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},__Point_276.prototype.getX=function(){return this.x.fromRed()},__Point_276.prototype.getY=function(){return this.y.fromRed()},__Point_276.prototype.mul=function(t){return t=new _$bn_189(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)},__Point_276.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},__Point_276.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},__Point_276.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))},__Point_276.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},__Point_276.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},_$inherits_browser_317(JPoint,_$base_272.BasePoint),ShortCurve.prototype.jpoint=function(t,e,r){return new JPoint(this,t,e,r)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),_=u.redMul(c.redISub(l)).redISub(o.redMul(f)),d=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,_,d)},JPoint.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),_=this.z.redMul(a);return this.curve.jpoint(c,l,_)},JPoint.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(n),0===this.x.cmp(r))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _$mont_275={};function MontCurve(t){_$base_272.call(this,"mont",t),this.a=new _$bn_189(t.a,16).toRed(this.red),this.b=new _$bn_189(t.b,16).toRed(this.red),this.i4=new _$bn_189(4).toRed(this.red).redInvm(),this.two=new _$bn_189(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function __Point_275(t,e,r){_$base_272.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _$bn_189(e,16),this.z=new _$bn_189(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}_$inherits_browser_317(MontCurve,_$base_272),_$mont_275=MontCurve,MontCurve.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},_$inherits_browser_317(__Point_275,_$base_272.BasePoint),MontCurve.prototype.decodePoint=function(t,e){return this.point(_$utils_285.toArray(t,e),1)},MontCurve.prototype.point=function(t,e){return new __Point_275(this,t,e)},MontCurve.prototype.pointFromJSON=function(t){return __Point_275.fromJSON(this,t)},__Point_275.prototype.precompute=function(){},__Point_275.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},__Point_275.fromJSON=function(t,e){return new __Point_275(t,e[0],e[1]||t.one)},__Point_275.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_275.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},__Point_275.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},__Point_275.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},__Point_275.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=n.redMul(i),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},__Point_275.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},__Point_275.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_275.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_275.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},__Point_275.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},__Point_275.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var _$edwards_273={};function EdwardsCurve(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,_$base_272.call(this,"edwards",t),this.a=new _$bn_189(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _$bn_189(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _$bn_189(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),this.oneC=1==(0|t.c)}function __Point_273(t,e,r,i,n){_$base_272.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _$bn_189(e,16),this.y=new _$bn_189(r,16),this.z=i?new _$bn_189(i,16):this.curve.one,this.t=n&&new _$bn_189(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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}_$utils_285.assert,_$inherits_browser_317(EdwardsCurve,_$base_272),_$edwards_273=EdwardsCurve,EdwardsCurve.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},EdwardsCurve.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},EdwardsCurve.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},EdwardsCurve.prototype.pointFromX=function(t,e){(t=new _$bn_189(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},EdwardsCurve.prototype.pointFromY=function(t,e){(t=new _$bn_189(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(n.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},EdwardsCurve.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},_$inherits_browser_317(__Point_273,_$base_272.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(t){return __Point_273.fromJSON(this,t)},EdwardsCurve.prototype.point=function(t,e,r,i){return new __Point_273(this,t,e,r,i)},__Point_273.fromJSON=function(t,e){return new __Point_273(t,e[0],e[1],e[2])},__Point_273.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_273.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},__Point_273.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),a=o.redSub(r),s=i.redSub(e),u=n.redMul(a),h=o.redMul(s),f=n.redMul(s),c=a.redMul(o);return this.curve.point(u,h,c,f)},__Point_273.prototype._projDbl=function(){var t,e,r,i,n,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var h=(i=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(h.redSub(this.curve.two)),e=h.redMul(i.redSub(u)),r=h.redSqr().redSub(h).redSub(h)):(n=this.z.redSqr(),o=h.redSub(n).redISub(n),t=a.redSub(s).redISub(u).redMul(o),e=h.redMul(i.redSub(u)),r=h.redMul(o))}else i=s.redAdd(u),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),t=this.curve._mulC(a.redISub(i)).redMul(o),e=this.curve._mulC(i).redMul(s.redISub(u)),r=i.redMul(o);return this.curve.point(t,e,r)},__Point_273.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},__Point_273.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=o.redMul(a),f=s.redMul(u),c=o.redMul(u),l=a.redMul(s);return this.curve.point(h,f,l,c)},__Point_273.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=i.redMul(h).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},__Point_273.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},__Point_273.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},__Point_273.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},__Point_273.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},__Point_273.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},__Point_273.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},__Point_273.prototype.getX=function(){return this.normalize(),this.x.fromRed()},__Point_273.prototype.getY=function(){return this.normalize(),this.y.fromRed()},__Point_273.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},__Point_273.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},__Point_273.prototype.toP=__Point_273.prototype.normalize,__Point_273.prototype.mixedAdd=__Point_273.prototype.add;var _$curve_274={},__curve_274=_$curve_274;__curve_274.base=_$base_272,__curve_274.short=_$short_276,__curve_274.mont=_$mont_275,__curve_274.edwards=_$edwards_273;var _$utils_315={};function isSurrogatePair(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function htonl(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function __zero2_315(t){return 1===t.length?"0"+t:t}function zero8(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}_$utils_315.inherits=_$inherits_browser_317,_$utils_315.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):isSurrogatePair(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return n},_$utils_315.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},_$utils_315.rotr32=function(t,e){return t>>>e|t<<32-e},_$utils_315.rotl32=function(t,e){return t<>>32-e},_$utils_315.sum32=function(t,e){return t+e>>>0},_$utils_315.sum32_3=function(t,e,r){return t+e+r>>>0},_$utils_315.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},_$utils_315.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},_$utils_315.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},_$utils_315.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},_$utils_315.sum64_lo=function(t,e,r,i){return e+i>>>0},_$utils_315.sum64_4_hi=function(t,e,r,i,n,o,a,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},_$utils_315.sum64_4_lo=function(t,e,r,i,n,o,a,s){return e+i+o+s>>>0},_$utils_315.sum64_5_hi=function(t,e,r,i,n,o,a,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},_$utils_315.sum64_5_lo=function(t,e,r,i,n,o,a,s,u,h){return e+i+o+s+h>>>0},_$utils_315.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},_$utils_315.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},_$utils_315.shr64_hi=function(t,e,r){return t>>>r},_$utils_315.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var _$common_305={};function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_$common_305.BlockHash=BlockHash,BlockHash.prototype.update=function(t,e){if(t=_$utils_315.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=_$utils_315.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o>>3},_$common_314.g1_256=function(t){return rotr32(t,17)^rotr32(t,19)^t>>>10};var _$1_309={},rotl32=_$utils_315.rotl32,sum32=_$utils_315.sum32,sum32_5=_$utils_315.sum32_5,ft_1=_$common_314.ft_1,__BlockHash_309=_$common_305.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;__BlockHash_309.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}_$utils_315.inherits(SHA1,__BlockHash_309),_$1_309=SHA1,SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest());for(var e=t.length;ethis.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=_$utils_325.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length"};var _$signature_280={};function Signature(t,e){if(t instanceof Signature)return t;this._importDER(t,e)||(this.r=new _$bn_189(t.r,16),this.s=new _$bn_189(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function Position(){this.place=0}function getLength(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,a=e.place;o>>=0;return!(n<=127)&&(e.place=a,n)}function rmPadding(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)}}_$utils_285.assert,_$signature_280=Signature,Signature.prototype._importDER=function(t,e){t=_$utils_285.toArray(t,e);var r=new Position;if(48!==t[r.place++])return!1;var i=getLength(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=getLength(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=getLength(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new _$bn_189(o),this.s=new _$bn_189(s),this.recoveryParam=null,!0},Signature.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=rmPadding(e),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];constructLength(i,e.length),(i=i.concat(e)).push(2),constructLength(i,r.length);var n=i.concat(r),o=[48];return constructLength(o,n.length),o=o.concat(n),_$utils_285.encode(o,t)};var _$ec_278={},__KeyPair_278=(_$utils_285.assert,_$key_279);function EC(t){if(!(this instanceof EC))return new EC(t);"string"==typeof t&&(t=_$curves_277[t]),t instanceof _$curves_277.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}_$ec_278=EC,EC.prototype.keyPair=function(t){return new __KeyPair_278(this,t)},EC.prototype.keyFromPrivate=function(t,e){return __KeyPair_278.fromPrivate(this,t,e)},EC.prototype.keyFromPublic=function(t,e){return __KeyPair_278.fromPublic(this,t,e)},EC.prototype.genKeyPair=function(t){t||(t={});for(var e=new _$hmacDrbg_316({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_$brorand_190(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _$bn_189(2));;){var n=new _$bn_189(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},EC.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},EC.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new _$bn_189(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),a=t.toArray("be",n),s=new _$hmacDrbg_316({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new _$bn_189(1)),h=0;;h++){var f=i.k?i.k(h):new _$bn_189(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var c=this.g.mul(f);if(!c.isInfinity()){var l=c.getX(),_=l.umod(this.n);if(0!==_.cmpn(0)){var d=f.invm(this.n).mul(_.mul(e.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var p=(c.getY().isOdd()?1:0)|(0!==l.cmp(_)?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),p^=1),new _$signature_280({r:_,s:d,recoveryParam:p})}}}}}},EC.prototype.verify=function(t,e,r,i){t=this._truncateToN(new _$bn_189(t,16)),r=this.keyFromPublic(r,i);var n=(e=new _$signature_280(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),h=s.mul(n).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(n):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(n)},EC.prototype.recoverPubKey=function(t,e,r,i){e=new _$signature_280(e,i);var n=this.n,o=new _$bn_189(t),a=e.r,s=e.s,u=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=e.r.invm(n),c=n.sub(o).mul(f).umod(n),l=s.mul(f).umod(n);return this.g.mulAdd(c,a,l)},EC.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new _$signature_280(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var _$key_282={},parseBytes=(_$utils_285.assert,_$utils_285.parseBytes),cachedProperty=_$utils_285.cachedProperty;function __KeyPair_282(t,e){this.eddsa=t,this._secret=parseBytes(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=parseBytes(e.pub)}__KeyPair_282.fromPublic=function(t,e){return e instanceof __KeyPair_282?e:new __KeyPair_282(t,{pub:e})},__KeyPair_282.fromSecret=function(t,e){return e instanceof __KeyPair_282?e:new __KeyPair_282(t,{secret:e})},__KeyPair_282.prototype.secret=function(){return this._secret},cachedProperty(__KeyPair_282,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty(__KeyPair_282,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty(__KeyPair_282,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),cachedProperty(__KeyPair_282,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty(__KeyPair_282,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty(__KeyPair_282,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),__KeyPair_282.prototype.sign=function(t){return this.eddsa.sign(t,this)},__KeyPair_282.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},__KeyPair_282.prototype.getSecret=function(t){return _$utils_285.encode(this.secret(),t)},__KeyPair_282.prototype.getPublic=function(t){return _$utils_285.encode(this.pubBytes(),t)},_$key_282=__KeyPair_282;var _$signature_283={},__cachedProperty_283=(_$utils_285.assert,_$utils_285.cachedProperty),__parseBytes_283=_$utils_285.parseBytes;function __Signature_283(t,e){this.eddsa=t,"object"!=typeof e&&(e=__parseBytes_283(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof _$bn_189&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}__cachedProperty_283(__Signature_283,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),__cachedProperty_283(__Signature_283,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),__cachedProperty_283(__Signature_283,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),__cachedProperty_283(__Signature_283,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),__Signature_283.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},__Signature_283.prototype.toHex=function(){return _$utils_285.encode(this.toBytes(),"hex").toUpperCase()},_$signature_283=__Signature_283;var _$eddsa_281={},__parseBytes_281=(_$utils_285.assert,_$utils_285.parseBytes);function EDDSA(t){if(!(this instanceof EDDSA))return new EDDSA(t);t=_$curves_277[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=_$hash_304.sha512}_$eddsa_281=EDDSA,EDDSA.prototype.sign=function(t,e){t=__parseBytes_281(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:o})},EDDSA.prototype.verify=function(t,e,r){t=__parseBytes_281(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},EDDSA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0)return null;var i=(r=r.toRed(ecparams.red)).redSqr().redIMul(r).redIAdd(ecparams.b).redSqrt();return 3===t!==i.isOdd()&&(i=i.redNeg()),ec.keyPair({pub:{x:r,y:i}})}(e,t.slice(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){var i=new _$bn_189(e),n=new _$bn_189(r);if(i.cmp(ecparams.p)>=0||n.cmp(ecparams.p)>=0)return null;if(i=i.toRed(ecparams.red),n=n.toRed(ecparams.red),(6===t||7===t)&&n.isOdd()!==(7===t))return null;var o=i.redSqr().redIMul(i);return n.redSqr().redISub(o.redIAdd(ecparams.b)).isZero()?ec.keyPair({pub:{x:i,y:n}}):null}(e,t.slice(1,33),t.slice(33,65));default:return null}}_$elliptic_354.privateKeyVerify=function(t){var e=new _$bn_189(t);return e.cmp(ecparams.n)<0&&!e.isZero()},_$elliptic_354.privateKeyExport=function(t,e){var r=new _$bn_189(t);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return __Buffer_354.from(ec.keyFromPrivate(t).getPublic(e,!0))},_$elliptic_354.privateKeyNegate=function(t){var e=new _$bn_189(t);return e.isZero()?__Buffer_354.alloc(32):ecparams.n.sub(e).umod(ecparams.n).toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.privateKeyModInverse=function(t){var e=new _$bn_189(t);if(e.cmp(ecparams.n)>=0||e.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_RANGE_INVALID);return e.invm(ecparams.n).toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.privateKeyTweakAdd=function(t,e){var r=new _$bn_189(e);if(r.cmp(ecparams.n)>=0)throw new Error(_$messages_356.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new _$bn_189(t)),r.cmp(ecparams.n)>=0&&r.isub(ecparams.n),r.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.privateKeyTweakMul=function(t,e){var r=new _$bn_189(e);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new _$bn_189(t)),r.cmp(ecparams.n)&&(r=r.umod(ecparams.n)),r.toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.publicKeyCreate=function(t,e){var r=new _$bn_189(t);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_356.EC_PUBLIC_KEY_CREATE_FAIL);return __Buffer_354.from(ec.keyFromPrivate(t).getPublic(e,!0))},_$elliptic_354.publicKeyConvert=function(t,e){var r=loadPublicKey(t);if(null===r)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);return __Buffer_354.from(r.getPublic(e,!0))},_$elliptic_354.publicKeyVerify=function(t){return null!==loadPublicKey(t)},_$elliptic_354.publicKeyTweakAdd=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);if((e=new _$bn_189(e)).cmp(ecparams.n)>=0)throw new Error(_$messages_356.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var n=ecparams.g.mul(e).add(i.pub);if(n.isInfinity())throw new Error(_$messages_356.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return __Buffer_354.from(n.encode(!0,r))},_$elliptic_354.publicKeyTweakMul=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);if((e=new _$bn_189(e)).cmp(ecparams.n)>=0||e.isZero())throw new Error(_$messages_356.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return __Buffer_354.from(i.pub.mul(e).encode(!0,r))},_$elliptic_354.publicKeyCombine=function(t,e){for(var r=new Array(t.length),i=0;i=0||r.cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);var i=__Buffer_354.from(t);return 1===r.cmp(ec.nh)&&ecparams.n.sub(r).toArrayLike(__Buffer_354,"be",32).copy(i,32),i},_$elliptic_354.signatureExport=function(t){var e=t.slice(0,32),r=t.slice(32,64);if(new _$bn_189(e).cmp(ecparams.n)>=0||new _$bn_189(r).cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);return{r:e,s:r}},_$elliptic_354.signatureImport=function(t){var e=new _$bn_189(t.r);e.cmp(ecparams.n)>=0&&(e=new _$bn_189(0));var r=new _$bn_189(t.s);return r.cmp(ecparams.n)>=0&&(r=new _$bn_189(0)),__Buffer_354.concat([e.toArrayLike(__Buffer_354,"be",32),r.toArrayLike(__Buffer_354,"be",32)])},_$elliptic_354.sign=function(t,e,r,i){if("function"==typeof r){var n=r;r=function(r){var o=n(t,e,null,i,r);if(!__Buffer_354.isBuffer(o)||32!==o.length)throw new Error(_$messages_356.ECDSA_SIGN_FAIL);return new _$bn_189(o)}}var o=new _$bn_189(e);if(o.cmp(ecparams.n)>=0||o.isZero())throw new Error(_$messages_356.ECDSA_SIGN_FAIL);var a=ec.sign(t,e,{canonical:!0,k:r,pers:i});return{signature:__Buffer_354.concat([a.r.toArrayLike(__Buffer_354,"be",32),a.s.toArrayLike(__Buffer_354,"be",32)]),recovery:a.recoveryParam}},_$elliptic_354.verify=function(t,e,r){var i={r:e.slice(0,32),s:e.slice(32,64)},n=new _$bn_189(i.r),o=new _$bn_189(i.s);if(n.cmp(ecparams.n)>=0||o.cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);if(1===o.cmp(ec.nh)||n.isZero()||o.isZero())return!1;var a=loadPublicKey(r);if(null===a)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);return ec.verify(t,i,{x:a.pub.x,y:a.pub.y})},_$elliptic_354.recover=function(t,e,r,i){var n={r:e.slice(0,32),s:e.slice(32,64)},o=new _$bn_189(n.r),a=new _$bn_189(n.s);if(o.cmp(ecparams.n)>=0||a.cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);try{if(o.isZero()||a.isZero())throw new Error;var s=ec.recoverPubKey(t,n,r);return __Buffer_354.from(s.encode(!0,i))}catch(err){throw new Error(_$messages_356.ECDSA_RECOVER_FAIL)}},_$elliptic_354.ecdh=function(t,e){var r=_$elliptic_354.ecdhUnsafe(t,e,!0);return _$browser_224("sha256").update(r).digest()},_$elliptic_354.ecdhUnsafe=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);var n=new _$bn_189(e);if(n.cmp(ecparams.n)>=0||n.isZero())throw new Error(_$messages_356.ECDH_FAIL);return __Buffer_354.from(i.pub.mul(n).encode(!0,r))};var _$elliptic_351=_$lib_355(_$elliptic_354),_$bitcoinjsMessage_188={};(function(t){const r="p2wpkh",i="p2sh(p2wpkh)";function n(t){return _$browser_224("sha256").update(t).digest()}function o(t){return _$browser_224("ripemd160").update(n(t)).digest()}function a(e,r){r=r||"\x18Bitcoin Signed Message:\n",t.isBuffer(r)||(r=t.from(r,"utf8")),t.isBuffer(e)||(e=t.from(e,"utf8"));const i=_$varuintBitcoin_392.encodingLength(e.length),o=t.allocUnsafe(r.length+i+e.length);return r.copy(o,0),_$varuintBitcoin_392.encode(e.length,o,r.length),e.copy(o,r.length+i),function(t){return n(n(t))}(o)}function s(e){return o(t.concat([t.from("0014","hex"),e]))}function u(e){const r=_$bech32_161.decode(e),i=_$bech32_161.fromWords(r.words.slice(1));return t.from(i)}_$bitcoinjsMessage_188={sign:function(e,n,o,s,u){const{messagePrefixArg:h,segwitType:f,extraEntropy:c}=function(t,e){"object"==typeof t&&void 0===e&&(e=t,t=void 0);let{segwitType:n,extraEntropy:o}=e||{};if(n&&("string"==typeof n||n instanceof String)&&(n=n.toLowerCase()),n&&n!==i&&n!==r)throw new Error('Unrecognized segwitType: use "'+i+'" or "'+r+'"');return{messagePrefixArg:t,segwitType:n,extraEntropy:o}}(s,u),l=a(e,h),_=function(t){return t&&"function"==typeof t.sign}(n)?n.sign(l,c):_$elliptic_351.sign(l,n,{data:c});return function(e,i,n,o){return void 0!==o?(i+=8,o===r&&(i+=4)):n&&(i+=4),t.concat([t.alloc(1,i+27),e])}(_.signature,_.recovery,o,f)},verify:function(n,h,f,c,l){t.isBuffer(f)||(f=t.from(f,"base64"));const _=function(t){if(65!==t.length)throw new Error("Invalid signature length");const e=t.readUInt8(0)-27;if(e>15||e<0)throw new Error("Invalid signature parameter");return{compressed:!!(12&e),segwitType:8&e?4&e?r:i:null,recovery:3&e,signature:t.slice(1)}}(f);if(l&&!_.compressed)throw new Error("checkSegwitAlways can only be used with a compressed pubkey signature flagbyte");const d=a(n,c),p=o(_$elliptic_351.recover(d,_.signature,_.recovery,_.compressed));let m,b;if(_.segwitType)_.segwitType===i?(m=s(p),b=_$bs58check_210.decode(h).slice(1)):(m=p,b=u(h));else if(l)try{return b=u(h),_$bufferEquals_211(p,b)}catch(e){const r=s(p);return b=_$bs58check_210.decode(h).slice(1),_$bufferEquals_211(p,b)||_$bufferEquals_211(r,b)}else m=p,b=_$bs58check_210.decode(h).slice(1);return _$bufferEquals_211(m,b)}}}).call(this,_$buffer_460({}).Buffer);var replace=String.prototype.replace,percentTwenties=/%20/g,Format_RFC1738="RFC1738",Format_RFC3986="RFC3986",_$formats_335={default:Format_RFC3986,formatters:{RFC1738:function(t){return replace.call(t,percentTwenties,"+")},RFC3986:function(t){return String(t)}},RFC1738:Format_RFC1738,RFC3986:Format_RFC3986},has=Object.prototype.hasOwnProperty,isArray=Array.isArray,hexTable=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),arrayToObject=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},i=0;i1;){var e=t.pop(),r=e.obj[e.prop];if(isArray(r)){for(var i=[],n=0;n=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===_$formats_335.RFC1738&&(40===u||41===u)?a+=o.charAt(s):u<128?a+=hexTable[u]:u<2048?a+=hexTable[192|u>>6]+hexTable[128|63&u]:u<55296||u>=57344?a+=hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|63&u]:(s+=1,u=65536+((1023&u)<<10|1023&o.charCodeAt(s)),a+=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|63&u])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(isArray(t)){for(var r=[],i=0;i0?m.join(",")||null:void 0}];else if(__isArray_338(s))b=s;else{var v=Object.keys(m);b=u?v.sort(u):v}for(var y=0;y0?c+f:""},__has_337=Object.prototype.hasOwnProperty,__isArray_337=Array.isArray,__defaults_337={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:_$utils_339.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},parseArrayValue=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},parseKeys=function(t,e,r,i){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),s=a?n.slice(0,a.index):n,u=[];if(s){if(!r.plainObjects&&__has_337.call(Object.prototype,s)&&!r.allowPrototypes)return;u.push(s)}for(var h=0;r.depth>0&&null!==(a=o.exec(n))&&h=0;--o){var a,s=t[o];if("[]"===s&&r.parseArrays)a=[].concat(n);else{a=r.plainObjects?Object.create(null):{};var u="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,h=parseInt(u,10);r.parseArrays||""!==u?!isNaN(h)&&s!==u&&String(h)===u&&h>=0&&r.parseArrays&&h<=r.arrayLimit?(a=[])[h]=n:a[u]=n:a={0:n}}n=a}return n}(u,e,r,i)}},_$parse_337=function(t,e){var r=function(t){if(!t)return __defaults_337;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?__defaults_337.charset:t.charset;return{allowDots:void 0===t.allowDots?__defaults_337.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:__defaults_337.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:__defaults_337.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:__defaults_337.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:__defaults_337.comma,decoder:"function"==typeof t.decoder?t.decoder:__defaults_337.decoder,delimiter:"string"==typeof t.delimiter||_$utils_339.isRegExp(t.delimiter)?t.delimiter:__defaults_337.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:__defaults_337.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:__defaults_337.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:__defaults_337.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:__defaults_337.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:__defaults_337.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){var r,i={},n=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,o=e.parameterLimit===1/0?void 0:e.parameterLimit,a=n.split(e.delimiter,o),s=-1,u=e.charset;if(e.charsetSentinel)for(r=0;r-1&&(f=__isArray_337(f)?[f]:f),__has_337.call(i,h)?i[h]=_$utils_339.combine(i[h],f):i[h]=f}return i}(t,r):t,n=r.plainObjects?Object.create(null):{},o=Object.keys(i),a=0;a>o%8,t._prev=shiftIn(t._prev,r?i:n);return a}function shiftIn(t,e){var r=t.length,i=-1,n=__Buffer_200.allocUnsafe(t.length);for(t=__Buffer_200.concat([t,__Buffer_200.from([e])]);++i>7;return n}_$cfb1_200.encrypt=function(t,e,r){for(var i=e.length,n=__Buffer_200.allocUnsafe(i),o=-1;++o>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&m]^e[b++],a=h[d>>>24]^f[p>>>16&255]^c[m>>>8&255]^l[255&_]^e[b++],s=h[p>>>24]^f[m>>>16&255]^c[_>>>8&255]^l[255&d]^e[b++],u=h[m>>>24]^f[_>>>16&255]^c[d>>>8&255]^l[255&p]^e[b++],_=o,d=a,p=s,m=u;return o=(i[_>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[b++],a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&_])^e[b++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[_>>>8&255]<<8|i[255&d])^e[b++],u=(i[m>>>24]<<24|i[_>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[a]=h,i[h]=a;var f=t[a],c=t[f],l=t[c],_=257*t[h]^16843008*h;n[0][a]=_<<24|_>>>8,n[1][a]=_<<16|_>>>16,n[2][a]=_<<8|_>>>24,n[3][a]=_,_=16843009*l^65537*c^257*f^16843008*a,o[0][h]=_<<24|_>>>8,o[1][h]=_<<16|_>>>16,o[2][h]=_<<8|_>>>24,o[3][h]=_,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function AES(t){this._key=asUInt32Array(t),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,a=G.SBOX[a>>>24]<<24|G.SBOX[a>>>16&255]<<16|G.SBOX[a>>>8&255]<<8|G.SBOX[255&a],a^=RCON[o/e|0]<<24):e>6&&o%e==4&&(a=G.SBOX[a>>>24]<<24|G.SBOX[a>>>16&255]<<16|G.SBOX[a>>>8&255]<<8|G.SBOX[255&a]),n[o]=n[o-e]^a}for(var s=[],u=0;u>>24]]^G.INV_SUB_MIX[1][G.SBOX[f>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[f>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},AES.prototype.encryptBlockRaw=function(t){return cryptBlock(t=asUInt32Array(t),this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=__Buffer_191.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},AES.prototype.decryptBlock=function(t){var e=(t=asUInt32Array(t))[1];t[1]=t[3],t[3]=e;var r=cryptBlock(t,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),i=__Buffer_191.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},_$aes_191.AES=AES;var _$ghash_196={},__Buffer_196=_$safeBuffer_345.Buffer,ZEROES=__Buffer_196.alloc(16,0);function fromArray(t){var e=__Buffer_196.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function GHASH(t){this.h=t,this.state=__Buffer_196.alloc(16,0),this.cache=__Buffer_196.allocUnsafe(0)}GHASH.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=fromArray(n)},GHASH.prototype.update=function(t){var e;for(this.cache=__Buffer_196.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},GHASH.prototype.final=function(t,e){return this.cache.length&&this.ghash(__Buffer_196.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,t,0,e])),this.state},_$ghash_196=GHASH;var _$authCipher_192={},__Buffer_192=_$safeBuffer_345.Buffer;function StreamCipher(t,e,r,i){_$cipherBase_223.call(this);var n=__Buffer_192.alloc(4,0);this._cipher=new _$aes_191.AES(e);var o=this._cipher.encryptBlock(n);this._ghash=new _$ghash_196(o),r=function(t,e,r){if(12===e.length)return t._finID=__Buffer_192.concat([e,__Buffer_192.from([0,0,0,1])]),__Buffer_192.concat([e,__Buffer_192.from([0,0,0,2])]);var i=new _$ghash_196(r),n=e.length,o=n%16;i.update(e),o&&(o=16-o,i.update(__Buffer_192.alloc(o,0))),i.update(__Buffer_192.alloc(8,0));var a=8*n,s=__Buffer_192.alloc(8);s.writeUIntBE(a,0,8),i.update(s),t._finID=i.state;var u=__Buffer_192.from(t._finID);return _$incr32_197(u),u}(this,r,o),this._prev=__Buffer_192.from(r),this._cache=__Buffer_192.allocUnsafe(0),this._secCache=__Buffer_192.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}_$inherits_browser_317(StreamCipher,_$cipherBase_223),StreamCipher.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=__Buffer_192.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},StreamCipher.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=_$bufferXor_212(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n0||i>0;){var u=new _$md5Js_321;u.update(s),u.update(t),e&&u.update(e),s=u.digest();var h=0;if(n>0){var f=o.length-n;h=Math.min(n,s.length),s.copy(o,f,0,h),n-=h}if(h0){var c=a.length-i,l=Math.min(i,s.length-h);s.copy(a,c,h,h+l),i-=l}}return s.fill(0),{key:o,iv:a}},_$encrypter_195={},__Buffer_195=_$safeBuffer_345.Buffer;function Cipher(t,e,r){_$cipherBase_223.call(this),this._cache=new Splitter,this._cipher=new _$aes_191.AES(e),this._prev=__Buffer_195.from(r),this._mode=t,this._autopadding=!0}_$inherits_browser_317(Cipher,_$cipherBase_223),Cipher.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return __Buffer_195.concat(i)};var PADDING=__Buffer_195.alloc(16,16);function Splitter(){this.cache=__Buffer_195.allocUnsafe(0)}function createCipheriv(t,e,r){var i=_$modes_204[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=__Buffer_195.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=__Buffer_195.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new _$streamCipher_207(i.module,e,r):"auth"===i.type?new _$authCipher_192(i.module,e,r):new Cipher(i.module,e,r)}Cipher.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},Splitter.prototype.add=function(t){this.cache=__Buffer_195.concat([this.cache,t])},Splitter.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},Splitter.prototype.flush=function(){for(var t=16-this.cache.length,e=__Buffer_195.allocUnsafe(t),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},__Splitter_194.prototype.flush=function(){if(this.cache.length)return this.cache};var _$browser_193={};_$encrypter_195.createCipher,_$browser_193.createCipheriv=_$encrypter_195.createCipheriv,_$decrypter_194.createDecipher,_$browser_193.createDecipheriv=_$decrypter_194.createDecipheriv;var _$browser_558={};(function(t,e){"use strict";var r=_$safeBuffer_576.Buffer,i=e.crypto||e.msCrypto;_$browser_558=i&&i.getRandomValues?function(e,n){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a0?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 __Buffer_508.alloc(0);for(var e,r,i,n=__Buffer_508.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_508.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_508.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:__custom_508,value:function(t,e){return __inspect_508(this,function(t){for(var e=1;e2?"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))}__createErrorType_501("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),__createErrorType_501("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(__oneOf_501(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(__oneOf_501(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),__createErrorType_501("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),__createErrorType_501("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),__createErrorType_501("ERR_STREAM_PREMATURE_CLOSE","Premature close"),__createErrorType_501("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),__createErrorType_501("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),__createErrorType_501("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),__createErrorType_501("ERR_STREAM_WRITE_AFTER_END","write after end"),__createErrorType_501("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),__createErrorType_501("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),__createErrorType_501("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_501.codes=__codes_501;var __ERR_INVALID_OPT_VALUE_513=_$errorsBrowser_501.codes.ERR_INVALID_OPT_VALUE,_$state_513={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new __ERR_INVALID_OPT_VALUE_513(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$Transform_505=__Transform_505,___require$codes_505=_$errorsBrowser_501.codes,__ERR_METHOD_NOT_IMPLEMENTED_505=___require$codes_505.ERR_METHOD_NOT_IMPLEMENTED,__ERR_MULTIPLE_CALLBACK_505=___require$codes_505.ERR_MULTIPLE_CALLBACK,__ERR_TRANSFORM_ALREADY_TRANSFORMING_505=___require$codes_505.ERR_TRANSFORM_ALREADY_TRANSFORMING,__ERR_TRANSFORM_WITH_LENGTH_0_505=___require$codes_505.ERR_TRANSFORM_WITH_LENGTH_0,__Duplex_505=_$Duplex_502({});function __afterTransform_505(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new __ERR_MULTIPLE_CALLBACK_505);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(__call_512),a||(o.forEach(__call_512),n(i))}))}));return e.reduce(__pipe_512)},_$readableBrowser_515={};_$readableBrowser_515=_$readableBrowser_515=_$_stream_readable_504({}),_$readableBrowser_515.Stream=_$readableBrowser_515,_$readableBrowser_515.Readable=_$readableBrowser_515,_$readableBrowser_515.Writable=_$_stream_writable_506({}),_$readableBrowser_515.Duplex=_$Duplex_502({}),_$readableBrowser_515.Transform=_$Transform_505,_$readableBrowser_515.PassThrough=_$PassThrough_503,_$readableBrowser_515.finished=_$eos_510({}),_$readableBrowser_515.pipeline=_$pipeline_512;var _$hashBase_500={},__Buffer_500=_$safeBuffer_576.Buffer,__Transform_500=_$readableBrowser_515.Transform;function __HashBase_500(t){__Transform_500.call(this),this._block=__Buffer_500.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}_$inherits_browser_530(__HashBase_500,__Transform_500),__HashBase_500.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(err){i=err}r(i)},__HashBase_500.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(err){e=err}t(e)},__HashBase_500.prototype.update=function(t,e){if(function(t,e){if(!__Buffer_500.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");__Buffer_500.isBuffer(t)||(t=__Buffer_500.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var n=this._blockOffset;n0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},__HashBase_500.prototype._update=function(){throw new Error("_update is not implemented")},__HashBase_500.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},__HashBase_500.prototype._digest=function(){throw new Error("_digest is not implemented")},_$hashBase_500=__HashBase_500;var _$md5Js_533={},__Buffer_533=_$safeBuffer_576.Buffer,__ARRAY16_533=new Array(16);function __MD5_533(){_$hashBase_500.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function __rotl_533(t,e){return t<>>32-e}function __fnF_533(t,e,r,i,n,o,a){return __rotl_533(t+(e&r|~e&i)+n+o|0,a)+e|0}function __fnG_533(t,e,r,i,n,o,a){return __rotl_533(t+(e&i|r&~i)+n+o|0,a)+e|0}function __fnH_533(t,e,r,i,n,o,a){return __rotl_533(t+(e^r^i)+n+o|0,a)+e|0}function __fnI_533(t,e,r,i,n,o,a){return __rotl_533(t+(r^(e|~i))+n+o|0,a)+e|0}_$inherits_browser_530(__MD5_533,_$hashBase_500),__MD5_533.prototype._update=function(){for(var t=__ARRAY16_533,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=__fnF_533(r,i,n,o,t[0],3614090360,7),o=__fnF_533(o,r,i,n,t[1],3905402710,12),n=__fnF_533(n,o,r,i,t[2],606105819,17),i=__fnF_533(i,n,o,r,t[3],3250441966,22),r=__fnF_533(r,i,n,o,t[4],4118548399,7),o=__fnF_533(o,r,i,n,t[5],1200080426,12),n=__fnF_533(n,o,r,i,t[6],2821735955,17),i=__fnF_533(i,n,o,r,t[7],4249261313,22),r=__fnF_533(r,i,n,o,t[8],1770035416,7),o=__fnF_533(o,r,i,n,t[9],2336552879,12),n=__fnF_533(n,o,r,i,t[10],4294925233,17),i=__fnF_533(i,n,o,r,t[11],2304563134,22),r=__fnF_533(r,i,n,o,t[12],1804603682,7),o=__fnF_533(o,r,i,n,t[13],4254626195,12),n=__fnF_533(n,o,r,i,t[14],2792965006,17),r=__fnG_533(r,i=__fnF_533(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=__fnG_533(o,r,i,n,t[6],3225465664,9),n=__fnG_533(n,o,r,i,t[11],643717713,14),i=__fnG_533(i,n,o,r,t[0],3921069994,20),r=__fnG_533(r,i,n,o,t[5],3593408605,5),o=__fnG_533(o,r,i,n,t[10],38016083,9),n=__fnG_533(n,o,r,i,t[15],3634488961,14),i=__fnG_533(i,n,o,r,t[4],3889429448,20),r=__fnG_533(r,i,n,o,t[9],568446438,5),o=__fnG_533(o,r,i,n,t[14],3275163606,9),n=__fnG_533(n,o,r,i,t[3],4107603335,14),i=__fnG_533(i,n,o,r,t[8],1163531501,20),r=__fnG_533(r,i,n,o,t[13],2850285829,5),o=__fnG_533(o,r,i,n,t[2],4243563512,9),n=__fnG_533(n,o,r,i,t[7],1735328473,14),r=__fnH_533(r,i=__fnG_533(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=__fnH_533(o,r,i,n,t[8],2272392833,11),n=__fnH_533(n,o,r,i,t[11],1839030562,16),i=__fnH_533(i,n,o,r,t[14],4259657740,23),r=__fnH_533(r,i,n,o,t[1],2763975236,4),o=__fnH_533(o,r,i,n,t[4],1272893353,11),n=__fnH_533(n,o,r,i,t[7],4139469664,16),i=__fnH_533(i,n,o,r,t[10],3200236656,23),r=__fnH_533(r,i,n,o,t[13],681279174,4),o=__fnH_533(o,r,i,n,t[0],3936430074,11),n=__fnH_533(n,o,r,i,t[3],3572445317,16),i=__fnH_533(i,n,o,r,t[6],76029189,23),r=__fnH_533(r,i,n,o,t[9],3654602809,4),o=__fnH_533(o,r,i,n,t[12],3873151461,11),n=__fnH_533(n,o,r,i,t[15],530742520,16),r=__fnI_533(r,i=__fnH_533(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=__fnI_533(o,r,i,n,t[7],1126891415,10),n=__fnI_533(n,o,r,i,t[14],2878612391,15),i=__fnI_533(i,n,o,r,t[5],4237533241,21),r=__fnI_533(r,i,n,o,t[12],1700485571,6),o=__fnI_533(o,r,i,n,t[3],2399980690,10),n=__fnI_533(n,o,r,i,t[10],4293915773,15),i=__fnI_533(i,n,o,r,t[1],2240044497,21),r=__fnI_533(r,i,n,o,t[8],1873313359,6),o=__fnI_533(o,r,i,n,t[15],4264355552,10),n=__fnI_533(n,o,r,i,t[6],2734768916,15),i=__fnI_533(i,n,o,r,t[13],1309151649,21),r=__fnI_533(r,i,n,o,t[4],4149444226,6),o=__fnI_533(o,r,i,n,t[11],3174756917,10),n=__fnI_533(n,o,r,i,t[2],718787259,15),i=__fnI_533(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},__MD5_533.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=__Buffer_533.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},_$md5Js_533=__MD5_533;var _$ripemd160_575={},__Buffer_575=_$buffer_460({}).Buffer,__ARRAY16_575=new Array(16),__zl_575=[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],__zr_575=[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],__sl_575=[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],__sr_575=[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],__hl_575=[0,1518500249,1859775393,2400959708,2840853838],__hr_575=[1352829926,1548603684,1836072691,2053994217,0];function __RIPEMD160_575(){_$hashBase_500.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function __rotl_575(t,e){return t<>>32-e}function __fn1_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e^r^i)+o+a|0,s)+n|0}function __fn2_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e&r|~e&i)+o+a|0,s)+n|0}function __fn3_575(t,e,r,i,n,o,a,s){return __rotl_575(t+((e|~r)^i)+o+a|0,s)+n|0}function __fn4_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e&i|r&~i)+o+a|0,s)+n|0}function __fn5_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e^(r|~i))+o+a|0,s)+n|0}_$inherits_browser_530(__RIPEMD160_575,_$hashBase_500),__RIPEMD160_575.prototype._update=function(){for(var t=__ARRAY16_575,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,f=0|this._d,c=0|this._e,l=0;l<80;l+=1){var _,d;l<16?(_=__fn1_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[0],__sl_575[l]),d=__fn5_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[0],__sr_575[l])):l<32?(_=__fn2_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[1],__sl_575[l]),d=__fn4_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[1],__sr_575[l])):l<48?(_=__fn3_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[2],__sl_575[l]),d=__fn3_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[2],__sr_575[l])):l<64?(_=__fn4_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[3],__sl_575[l]),d=__fn2_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[3],__sr_575[l])):(_=__fn5_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[4],__sl_575[l]),d=__fn1_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[4],__sr_575[l])),r=a,a=o,o=__rotl_575(n,10),n=i,i=_,s=c,c=f,f=__rotl_575(h,10),h=u,u=d}var p=this._b+n+f|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+i+h|0,this._a=p},__RIPEMD160_575.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=__Buffer_575.alloc?__Buffer_575.alloc(20):new __Buffer_575(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},_$ripemd160_575=__RIPEMD160_575;var _$hash_577={},__Buffer_577=_$safeBuffer_576.Buffer;function __Hash_577(t,e){this._block=__Buffer_577.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}__Hash_577.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=__Buffer_577.from(t,e));for(var r=this._block,i=this._blockSize,n=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},__Hash_577.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_$hash_577=__Hash_577;var _$sha_579={},__Buffer_579=_$safeBuffer_576.Buffer,__K_579=[1518500249,1859775393,-1894007588,-899497514],__W_579=new Array(80);function __Sha_579(){this.init(),this._w=__W_579,_$hash_577.call(this,64,56)}function __rotl30_579(t){return t<<30|t>>>2}function __ft_579(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_530(__Sha_579,_$hash_577),__Sha_579.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},__Sha_579.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var f=~~(h/20),c=0|((e=i)<<5|e>>>27)+__ft_579(f,n,o,a)+s+r[h]+__K_579[f];s=a,a=o,o=__rotl30_579(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},__Sha_579.prototype._hash=function(){var t=__Buffer_579.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},_$sha_579=__Sha_579;var _$sha1_580={},__Buffer_580=_$safeBuffer_576.Buffer,__K_580=[1518500249,1859775393,-1894007588,-899497514],__W_580=new Array(80);function __Sha1_580(){this.init(),this._w=__W_580,_$hash_577.call(this,64,56)}function __rotl5_580(t){return t<<5|t>>>27}function __rotl30_580(t){return t<<30|t>>>2}function __ft_580(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_530(__Sha1_580,_$hash_577),__Sha1_580.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},__Sha1_580.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=(e=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|e>>>31;for(var h=0;h<80;++h){var f=~~(h/20),c=__rotl5_580(i)+__ft_580(f,n,o,a)+s+r[h]+__K_580[f]|0;s=a,a=o,o=__rotl30_580(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},__Sha1_580.prototype._hash=function(){var t=__Buffer_580.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},_$sha1_580=__Sha1_580;var _$sha256_582={},__Buffer_582=_$safeBuffer_576.Buffer,__K_582=[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],__W_582=new Array(64);function __Sha256_582(){this.init(),this._w=__W_582,_$hash_577.call(this,64,56)}function __ch_582(t,e,r){return r^t&(e^r)}function __maj_582(t,e,r){return t&e|r&(t|e)}function __sigma0_582(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function __sigma1_582(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function __gamma0_582(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}_$inherits_browser_530(__Sha256_582,_$hash_577),__Sha256_582.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},__Sha256_582.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,f=0|this._h,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<64;++c)r[c]=0|(((e=r[c-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[c-7]+__gamma0_582(r[c-15])+r[c-16];for(var l=0;l<64;++l){var _=f+__sigma1_582(s)+__ch_582(s,u,h)+__K_582[l]+r[l]|0,d=__sigma0_582(i)+__maj_582(i,n,o)|0;f=h,h=u,u=s,s=a+_|0,a=o,o=n,n=i,i=_+d|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=f+this._h|0},__Sha256_582.prototype._hash=function(){var t=__Buffer_582.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},_$sha256_582=__Sha256_582;var _$sha224_581={},__Buffer_581=_$safeBuffer_576.Buffer,__W_581=new Array(64);function __Sha224_581(){this.init(),this._w=__W_581,_$hash_577.call(this,64,56)}_$inherits_browser_530(__Sha224_581,_$sha256_582),__Sha224_581.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},__Sha224_581.prototype._hash=function(){var t=__Buffer_581.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},_$sha224_581=__Sha224_581;var _$sha512_584={},__Buffer_584=_$safeBuffer_576.Buffer,__K_584=[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],__W_584=new Array(160);function __Sha512_584(){this.init(),this._w=__W_584,_$hash_577.call(this,128,112)}function __Ch_584(t,e,r){return r^t&(e^r)}function __maj_584(t,e,r){return t&e|r&(t|e)}function __sigma0_584(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function __sigma1_584(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function __Gamma0_584(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function __Gamma0l_584(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function __Gamma1_584(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function __Gamma1l_584(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function __getCarry_584(t,e){return t>>>0>>0?1:0}_$inherits_browser_530(__Sha512_584,_$hash_577),__Sha512_584.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},__Sha512_584.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,f=0|this._al,c=0|this._bl,l=0|this._cl,_=0|this._dl,d=0|this._el,p=0|this._fl,m=0|this._gl,b=0|this._hl,g=0;g<32;g+=2)e[g]=t.readInt32BE(4*g),e[g+1]=t.readInt32BE(4*g+4);for(;g<160;g+=2){var v=e[g-30],y=e[g-30+1],w=__Gamma0_584(v,y),M=__Gamma0l_584(y,v),S=__Gamma1_584(v=e[g-4],y=e[g-4+1]),$=__Gamma1l_584(y,v),E=e[g-14],k=e[g-14+1],A=e[g-32],B=e[g-32+1],x=M+k|0,T=w+E+__getCarry_584(x,M)|0;T=(T=T+S+__getCarry_584(x=x+$|0,$)|0)+A+__getCarry_584(x=x+B|0,B)|0,e[g]=T,e[g+1]=x}for(var P=0;P<160;P+=2){T=e[P],x=e[P+1];var R=__maj_584(r,i,n),I=__maj_584(f,c,l),C=__sigma0_584(r,f),O=__sigma0_584(f,r),N=__sigma1_584(a,d),L=__sigma1_584(d,a),U=__K_584[P],D=__K_584[P+1],z=__Ch_584(a,s,u),j=__Ch_584(d,p,m),H=b+L|0,q=h+N+__getCarry_584(H,b)|0;q=(q=(q=q+z+__getCarry_584(H=H+j|0,j)|0)+U+__getCarry_584(H=H+D|0,D)|0)+T+__getCarry_584(H=H+x|0,x)|0;var F=O+I|0,K=C+R+__getCarry_584(F,O)|0;h=u,b=m,u=s,m=p,s=a,p=d,a=o+q+__getCarry_584(d=_+H|0,_)|0,o=n,_=l,n=i,l=c,i=r,c=f,r=q+K+__getCarry_584(f=H+F|0,H)|0}this._al=this._al+f|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+_|0,this._el=this._el+d|0,this._fl=this._fl+p|0,this._gl=this._gl+m|0,this._hl=this._hl+b|0,this._ah=this._ah+r+__getCarry_584(this._al,f)|0,this._bh=this._bh+i+__getCarry_584(this._bl,c)|0,this._ch=this._ch+n+__getCarry_584(this._cl,l)|0,this._dh=this._dh+o+__getCarry_584(this._dl,_)|0,this._eh=this._eh+a+__getCarry_584(this._el,d)|0,this._fh=this._fh+s+__getCarry_584(this._fl,p)|0,this._gh=this._gh+u+__getCarry_584(this._gl,m)|0,this._hh=this._hh+h+__getCarry_584(this._hl,b)|0},__Sha512_584.prototype._hash=function(){var t=__Buffer_584.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha512_584=__Sha512_584;var _$sha384_583={},__Buffer_583=_$safeBuffer_576.Buffer,__W_583=new Array(160);function __Sha384_583(){this.init(),this._w=__W_583,_$hash_577.call(this,128,112)}_$inherits_browser_530(__Sha384_583,_$sha512_584),__Sha384_583.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},__Sha384_583.prototype._hash=function(){var t=__Buffer_583.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha384_583=__Sha384_583;var _$shaJs_578={},__exports_578=_$shaJs_578=function(t){t=t.toLowerCase();var e=__exports_578[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};__exports_578.sha=_$sha_579,__exports_578.sha1=_$sha1_580,__exports_578.sha224=_$sha224_581,__exports_578.sha256=_$sha256_582,__exports_578.sha384=_$sha384_583,__exports_578.sha512=_$sha512_584;var _$cipherBase_461={},__Buffer_461=_$safeBuffer_576.Buffer,__Transform_461=_$Stream_585.Transform,__StringDecoder_461=_$string_decoder_586({}).StringDecoder;function __CipherBase_461(t){__Transform_461.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}_$inherits_browser_530(__CipherBase_461,__Transform_461),__CipherBase_461.prototype.update=function(t,e,r){"string"==typeof t&&(t=__Buffer_461.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},__CipherBase_461.prototype.setAutoPadding=function(){},__CipherBase_461.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},__CipherBase_461.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},__CipherBase_461.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},__CipherBase_461.prototype._transform=function(t,r,i){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(e){n=e}finally{i(n)}},__CipherBase_461.prototype._flush=function(t){var r;try{this.push(this.__final())}catch(e){r=e}t(r)},__CipherBase_461.prototype._finalOrDigest=function(t){var e=this.__final()||__Buffer_461.alloc(0);return t&&(e=this._toString(e,t,!0)),e},__CipherBase_461.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new __StringDecoder_461(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},_$cipherBase_461=__CipherBase_461;var _$browser_465={};function __Hash_465(t){_$cipherBase_461.call(this,"digest"),this._hash=t}_$inherits_browser_530(__Hash_465,_$cipherBase_461),__Hash_465.prototype._update=function(t){this._hash.update(t)},__Hash_465.prototype._final=function(){return this._hash.digest()},_$browser_465=function(t){return"md5"===(t=t.toLowerCase())?new _$md5Js_533:"rmd160"===t||"ripemd160"===t?new _$ripemd160_575:new __Hash_465(_$shaJs_578(t))};var _$legacy_468={},__Buffer_468=_$safeBuffer_576.Buffer,__ZEROS_468=__Buffer_468.alloc(128),__blocksize_468=64;function __Hmac_468(t,e){_$cipherBase_461.call(this,"digest"),"string"==typeof e&&(e=__Buffer_468.from(e)),this._alg=t,this._key=e,e.length>__blocksize_468?e=t(e):e.length<__blocksize_468&&(e=__Buffer_468.concat([e,__ZEROS_468],__blocksize_468));for(var r=this._ipad=__Buffer_468.allocUnsafe(__blocksize_468),i=this._opad=__Buffer_468.allocUnsafe(__blocksize_468),n=0;n<__blocksize_468;n++)r[n]=54^e[n],i[n]=92^e[n];this._hash=[r]}_$inherits_browser_530(__Hmac_468,_$cipherBase_461),__Hmac_468.prototype._update=function(t){this._hash.push(t)},__Hmac_468.prototype._final=function(){var t=this._alg(__Buffer_468.concat(this._hash));return this._alg(__Buffer_468.concat([this._opad,t]))},_$legacy_468=__Hmac_468;var _$md5_466=function(t){return(new _$md5Js_533).update(t).digest()},_$browser_467={},__Buffer_467=_$safeBuffer_576.Buffer,__ZEROS_467=__Buffer_467.alloc(128);function __Hmac_467(t,e){_$cipherBase_461.call(this,"digest"),"string"==typeof e&&(e=__Buffer_467.from(e));var r="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>r?e=("rmd160"===t?new _$ripemd160_575:_$shaJs_578(t)).update(e).digest():e.lengthMAX_ALLOC||e!=e)throw new TypeError("Bad key length")},_$defaultEncoding_545={};(function(t){var e;e=t.browser?"utf-8":t.version?parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",_$defaultEncoding_545=e}).call(this,_$browser_550);var __Buffer_548=_$safeBuffer_576.Buffer,_$toBuffer_548=function(t,e,r){if(__Buffer_548.isBuffer(t))return t;if("string"==typeof t)return __Buffer_548.from(t,e);if(ArrayBuffer.isView(t))return __Buffer_548.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},_$syncBrowser_547={},__Buffer_547=_$safeBuffer_576.Buffer,__ZEROS_547=__Buffer_547.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function __Hmac_547(t,e,r){var i=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new _$ripemd160_575).update(t).digest()}:"md5"===t?_$md5_466:function(e){return _$shaJs_578(t).update(e).digest()}}(t),n="sha512"===t||"sha384"===t?128:64;e.length>n?e=i(e):e.length>>0},writeUInt32BE:function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},ip:function(t,e,r,i){for(var n=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[i+0]=n>>>0,r[i+1]=o>>>0},rip:function(t,e,r,i){for(var n=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)n<<=1,n|=e>>>s+a&1,n<<=1,n|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},pc1:function(t,e,r,i){for(var n=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1}for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},r28shl:function(t,e){return t<>>28-e}},pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];_$utils_475.pc2=function(t,e,r,i){for(var n=0,o=0,a=pc2table.length>>>1,s=0;s>>pc2table[s]&1;for(s=a;s>>pc2table[s]&1;r[i+0]=n>>>0,r[i+1]=o>>>0},_$utils_475.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=t>>>o&63;for(o=11;o>=3;o-=4)n|=t>>>o&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];_$utils_475.substitute=function(t,e){for(var r=0,i=0;i<4;i++)r<<=4,r|=sTable[64*i+(t>>>18-6*i&63)];for(i=0;i<4;i++)r<<=4,r|=sTable[256+64*i+(e>>>18-6*i&63)];return r>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];_$utils_475.permute=function(t){for(var e=0,r=0;r>>permuteTable[r]&1;return e>>>0},_$utils_475.padSplit=function(t,e,r){for(var i=t.toString(2);i.length0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},__Cipher_472.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},__Cipher_472.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=_$utils_475.r28shl(r,o),i=_$utils_475.r28shl(i,o),_$utils_475.pc2(r,i,t.keys,n)}},DES.prototype._update=function(t,e,r,i){var n=this._desState,o=_$utils_475.readUInt32BE(t,e),a=_$utils_475.readUInt32BE(t,e+4);_$utils_475.ip(o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,a,n.tmp,0):this._decrypt(n,o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],_$utils_475.writeUInt32BE(r,o,i),_$utils_475.writeUInt32BE(r,a,i+4)},DES.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,o=c}_$utils_475.rip(a,o,i,n)},DES.prototype._decrypt=function(t,e,r,i,n){for(var o=r,a=e,s=t.keys.length-2;s>=0;s-=2){var u=t.keys[s],h=t.keys[s+1];_$utils_475.expand(o,t.tmp,0),u^=t.tmp[0],h^=t.tmp[1];var f=_$utils_475.substitute(u,h),c=o;o=(a^_$utils_475.permute(f))>>>0,a=c}_$utils_475.rip(o,a,i,n)};var _$cbc_471={},__proto_471={};function CBCState(t){this.iv=new Array(8);for(var e=0;e>o%8,t._prev=__shiftIn_425(t._prev,r?i:n);return a}function __shiftIn_425(t,e){var r=t.length,i=-1,n=__Buffer_425.allocUnsafe(t.length);for(t=__Buffer_425.concat([t,__Buffer_425.from([e])]);++i>7;return n}_$cfb1_425.encrypt=function(t,e,r){for(var i=e.length,n=__Buffer_425.allocUnsafe(i),o=-1;++o>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&m]^e[b++],a=h[d>>>24]^f[p>>>16&255]^c[m>>>8&255]^l[255&_]^e[b++],s=h[p>>>24]^f[m>>>16&255]^c[_>>>8&255]^l[255&d]^e[b++],u=h[m>>>24]^f[_>>>16&255]^c[d>>>8&255]^l[255&p]^e[b++],_=o,d=a,p=s,m=u;return o=(i[_>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[b++],a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&_])^e[b++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[_>>>8&255]<<8|i[255&d])^e[b++],u=(i[m>>>24]<<24|i[_>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var __RCON_416=[0,1,2,4,8,16,32,64,128,27,54],__G_416=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[a]=h,i[h]=a;var f=t[a],c=t[f],l=t[c],_=257*t[h]^16843008*h;n[0][a]=_<<24|_>>>8,n[1][a]=_<<16|_>>>16,n[2][a]=_<<8|_>>>24,n[3][a]=_,_=16843009*l^65537*c^257*f^16843008*a,o[0][h]=_<<24|_>>>8,o[1][h]=_<<16|_>>>16,o[2][h]=_<<8|_>>>24,o[3][h]=_,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function __AES_416(t){this._key=__asUInt32Array_416(t),this._reset()}__AES_416.blockSize=16,__AES_416.keySize=32,__AES_416.prototype.blockSize=__AES_416.blockSize,__AES_416.prototype.keySize=__AES_416.keySize,__AES_416.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,a=__G_416.SBOX[a>>>24]<<24|__G_416.SBOX[a>>>16&255]<<16|__G_416.SBOX[a>>>8&255]<<8|__G_416.SBOX[255&a],a^=__RCON_416[o/e|0]<<24):e>6&&o%e==4&&(a=__G_416.SBOX[a>>>24]<<24|__G_416.SBOX[a>>>16&255]<<16|__G_416.SBOX[a>>>8&255]<<8|__G_416.SBOX[255&a]),n[o]=n[o-e]^a}for(var s=[],u=0;u>>24]]^__G_416.INV_SUB_MIX[1][__G_416.SBOX[f>>>16&255]]^__G_416.INV_SUB_MIX[2][__G_416.SBOX[f>>>8&255]]^__G_416.INV_SUB_MIX[3][__G_416.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},__AES_416.prototype.encryptBlockRaw=function(t){return __cryptBlock_416(t=__asUInt32Array_416(t),this._keySchedule,__G_416.SUB_MIX,__G_416.SBOX,this._nRounds)},__AES_416.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=__Buffer_416.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},__AES_416.prototype.decryptBlock=function(t){var e=(t=__asUInt32Array_416(t))[1];t[1]=t[3],t[3]=e;var r=__cryptBlock_416(t,this._invKeySchedule,__G_416.INV_SUB_MIX,__G_416.INV_SBOX,this._nRounds),i=__Buffer_416.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},__AES_416.prototype.scrub=function(){__scrubVec_416(this._keySchedule),__scrubVec_416(this._invKeySchedule),__scrubVec_416(this._key)},_$aes_416.AES=__AES_416;var _$ghash_421={},__Buffer_421=_$safeBuffer_576.Buffer,__ZEROES_421=__Buffer_421.alloc(16,0);function __fromArray_421(t){var e=__Buffer_421.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function __GHASH_421(t){this.h=t,this.state=__Buffer_421.alloc(16,0),this.cache=__Buffer_421.allocUnsafe(0)}__GHASH_421.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=__fromArray_421(n)},__GHASH_421.prototype.update=function(t){var e;for(this.cache=__Buffer_421.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},__GHASH_421.prototype.final=function(t,e){return this.cache.length&&this.ghash(__Buffer_421.concat([this.cache,__ZEROES_421],16)),this.ghash(__fromArray_421([0,t,0,e])),this.state},_$ghash_421=__GHASH_421;var _$authCipher_417={},__Buffer_417=_$safeBuffer_576.Buffer;function __StreamCipher_417(t,e,r,i){_$cipherBase_461.call(this);var n=__Buffer_417.alloc(4,0);this._cipher=new _$aes_416.AES(e);var o=this._cipher.encryptBlock(n);this._ghash=new _$ghash_421(o),r=function(t,e,r){if(12===e.length)return t._finID=__Buffer_417.concat([e,__Buffer_417.from([0,0,0,1])]),__Buffer_417.concat([e,__Buffer_417.from([0,0,0,2])]);var i=new _$ghash_421(r),n=e.length,o=n%16;i.update(e),o&&(o=16-o,i.update(__Buffer_417.alloc(o,0))),i.update(__Buffer_417.alloc(8,0));var a=8*n,s=__Buffer_417.alloc(8);s.writeUIntBE(a,0,8),i.update(s),t._finID=i.state;var u=__Buffer_417.from(t._finID);return _$incr32_422(u),u}(this,r,o),this._prev=__Buffer_417.from(r),this._cache=__Buffer_417.allocUnsafe(0),this._secCache=__Buffer_417.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}_$inherits_browser_530(__StreamCipher_417,_$cipherBase_461),__StreamCipher_417.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=__Buffer_417.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},__StreamCipher_417.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=_$bufferXor_459(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n0||i>0;){var u=new _$md5Js_533;u.update(s),u.update(t),e&&u.update(e),s=u.digest();var h=0;if(n>0){var f=o.length-n;h=Math.min(n,s.length),s.copy(o,f,0,h),n-=h}if(h0){var c=a.length-i,l=Math.min(i,s.length-h);s.copy(a,c,h,h+l),i-=l}}return s.fill(0),{key:o,iv:a}},_$encrypter_420={},__Buffer_420=_$safeBuffer_576.Buffer;function __Cipher_420(t,e,r){_$cipherBase_461.call(this),this._cache=new __Splitter_420,this._cipher=new _$aes_416.AES(e),this._prev=__Buffer_420.from(r),this._mode=t,this._autopadding=!0}_$inherits_browser_530(__Cipher_420,_$cipherBase_461),__Cipher_420.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return __Buffer_420.concat(i)};var __PADDING_420=__Buffer_420.alloc(16,16);function __Splitter_420(){this.cache=__Buffer_420.allocUnsafe(0)}function __createCipheriv_420(t,e,r){var i=_$modes_429[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=__Buffer_420.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=__Buffer_420.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new _$streamCipher_432(i.module,e,r):"auth"===i.type?new _$authCipher_417(i.module,e,r):new __Cipher_420(i.module,e,r)}__Cipher_420.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(__PADDING_420))throw this._cipher.scrub(),new Error("data not multiple of block length")},__Cipher_420.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},__Splitter_420.prototype.add=function(t){this.cache=__Buffer_420.concat([this.cache,t])},__Splitter_420.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},__Splitter_420.prototype.flush=function(){for(var t=16-this.cache.length,e=__Buffer_420.allocUnsafe(t),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},__Splitter_419.prototype.flush=function(){if(this.cache.length)return this.cache};var _$browser_418={};_$encrypter_420.createCipher,_$browser_418.createCipheriv=_$encrypter_420.createCipheriv,_$decrypter_419.createDecipher,_$browser_418.createDecipheriv=_$decrypter_419.createDecipheriv,_$browser_418.getCiphers=function(){return Object.keys(_$list_430)};var _$modes_435={"des-ecb":{key:8,iv:0}};_$modes_435["des-cbc"]=_$modes_435.des={key:8,iv:8},_$modes_435["des-ede3-cbc"]=_$modes_435.des3={key:24,iv:8},_$modes_435["des-ede3"]={key:24,iv:0},_$modes_435["des-ede-cbc"]={key:16,iv:8},_$modes_435["des-ede"]={key:16,iv:0};var _$browser_433={};function __createCipheriv_433(t,e,r){if(t=t.toLowerCase(),_$modes_429[t])return _$browser_418.createCipheriv(t,e,r);if(_$modes_435[t])return new _$browserifyDes_434({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function __createDecipheriv_433(t,e,r){if(t=t.toLowerCase(),_$modes_429[t])return _$browser_418.createDecipheriv(t,e,r);if(_$modes_435[t])return new _$browserifyDes_434({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}_$browser_433.createCipher=_$browser_433.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),_$modes_429[t])r=_$modes_429[t].key,i=_$modes_429[t].iv;else{if(!_$modes_435[t])throw new TypeError("invalid suite type");r=8*_$modes_435[t].key,i=_$modes_435[t].iv}var n=_$evp_bytestokey_499(e,!1,r,i);return __createCipheriv_433(t,n.key,n.iv)},_$browser_433.createCipheriv=_$browser_433.Cipheriv=__createCipheriv_433,_$browser_433.createDecipher=_$browser_433.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),_$modes_429[t])r=_$modes_429[t].key,i=_$modes_429[t].iv;else{if(!_$modes_435[t])throw new TypeError("invalid suite type");r=8*_$modes_435[t].key,i=_$modes_435[t].iv}var n=_$evp_bytestokey_499(e,!1,r,i);return __createDecipheriv_433(t,n.key,n.iv)},_$browser_433.createDecipheriv=_$browser_433.Decipheriv=__createDecipheriv_433,_$browser_433.listCiphers=_$browser_433.getCiphers=function(){return Object.keys(_$modes_435).concat(_$browser_418.getCiphers())};var _$bn_480={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_480,this),_$bn_480=_$bn_480.exports;var _$bn_535={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_535,this),_$bn_535=_$bn_535.exports;var _$brorand_414={},__r_414;function __Rand_414(t){this.rand=t}if(_$brorand_414=function(t){return __r_414||(__r_414=new __Rand_414(null)),__r_414.generate(t)},_$brorand_414.Rand=__Rand_414,__Rand_414.prototype.generate=function(t){return this._rand(t)},__Rand_414.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r=0);return i},MillerRabin.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},MillerRabin.prototype.test=function(t,e,r){var i=t.bitLength(),n=_$bn_535.mont(t),o=new _$bn_535(1).toRed(n);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),h=a.toRed(n);e>0;e--){var f=this._randrange(new _$bn_535(2),a);r&&r(f);var c=f.toRed(n).redPow(u);if(0!==c.cmp(o)&&0!==c.cmp(h)){for(var l=1;l0;e--){var h=this._randrange(new _$bn_535(2),o),f=t.gcd(h);if(0!==f.cmpn(1))return f;var c=h.toRed(i).redPow(s);if(0!==c.cmp(n)&&0!==c.cmp(u)){for(var l=1;lt;)r.ishrn(1);if(r.isEven()&&r.iadd(__ONE_478),r.testn(1)||r.iadd(TWO),e.cmp(TWO)){if(!e.cmp(FIVE))for(;r.mod(TEN).cmp(__THREE_478);)r.iadd(FOUR)}else for(;r.mod(TWENTYFOUR).cmp(ELEVEN);)r.iadd(FOUR);if(simpleSieve(i=r.shrn(1))&&simpleSieve(r)&&fermatTest(i)&&fermatTest(r)&&millerRabin.test(i)&&millerRabin.test(r))return r}}var _$primes_479={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},_$DH_477={};(function(t){var e=new _$mr_534,r=new _$bn_480(24),i=new _$bn_480(11),n=new _$bn_480(10),o=new _$bn_480(3),a=new _$bn_480(7);function s(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._pub=new _$bn_480(e),this}function u(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._priv=new _$bn_480(e),this}_$DH_477=f;var h={};function f(t,e,r){this.setGenerator(e),this.__prime=new _$bn_480(t),this._prime=_$bn_480.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=s,this.setPrivateKey=u):this._primeCode=8}function c(e,r){var i=new t(e.toArray());return r?i.toString(r):i}Object.defineProperty(f.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,s){var u=s.toString("hex"),f=[u,t.toString(16)].join("_");if(f in h)return h[f];var c,l=0;if(t.isEven()||!_$generatePrime_478.simpleSieve||!_$generatePrime_478.fermatTest(t)||!e.test(t))return l+=1,l+="02"===u||"05"===u?8:4,h[f]=l,l;switch(e.test(t.shrn(1))||(l+=2),u){case"02":t.mod(r).cmp(i)&&(l+=8);break;case"05":(c=t.mod(n)).cmp(o)&&c.cmp(a)&&(l+=8);break;default:l+=4}return h[f]=l,l}(this.__prime,this.__gen)),this._primeCode}}),f.prototype.generateKeys=function(){return this._priv||(this._priv=new _$bn_480(_$browser_558(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},f.prototype.computeSecret=function(e){var r=(e=(e=new _$bn_480(e)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new t(r.toArray()),n=this.getPrime();if(i.length0?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 __Buffer_451.alloc(0);for(var e,r,i,n=__Buffer_451.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_451.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_451.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:__custom_451,value:function(t,e){return __inspect_451(this,function(t){for(var e=1;e2?"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))}__createErrorType_444("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),__createErrorType_444("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(__oneOf_444(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(__oneOf_444(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),__createErrorType_444("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),__createErrorType_444("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),__createErrorType_444("ERR_STREAM_PREMATURE_CLOSE","Premature close"),__createErrorType_444("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),__createErrorType_444("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),__createErrorType_444("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),__createErrorType_444("ERR_STREAM_WRITE_AFTER_END","write after end"),__createErrorType_444("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),__createErrorType_444("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),__createErrorType_444("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_444.codes=__codes_444;var __ERR_INVALID_OPT_VALUE_456=_$errorsBrowser_444.codes.ERR_INVALID_OPT_VALUE,_$state_456={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new __ERR_INVALID_OPT_VALUE_456(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$Transform_448=__Transform_448,___require$codes_448=_$errorsBrowser_444.codes,__ERR_METHOD_NOT_IMPLEMENTED_448=___require$codes_448.ERR_METHOD_NOT_IMPLEMENTED,__ERR_MULTIPLE_CALLBACK_448=___require$codes_448.ERR_MULTIPLE_CALLBACK,__ERR_TRANSFORM_ALREADY_TRANSFORMING_448=___require$codes_448.ERR_TRANSFORM_ALREADY_TRANSFORMING,__ERR_TRANSFORM_WITH_LENGTH_0_448=___require$codes_448.ERR_TRANSFORM_WITH_LENGTH_0,__Duplex_448=_$Duplex_445({});function __afterTransform_448(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new __ERR_MULTIPLE_CALLBACK_448);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(__call_455),a||(o.forEach(__call_455),n(i))}))}));return e.reduce(__pipe_455)},_$readableBrowser_458={};_$readableBrowser_458=_$readableBrowser_458=_$_stream_readable_447({}),_$readableBrowser_458.Stream=_$readableBrowser_458,_$readableBrowser_458.Readable=_$readableBrowser_458,_$readableBrowser_458.Writable=_$_stream_writable_449({}),_$readableBrowser_458.Duplex=_$Duplex_445({}),_$readableBrowser_458.Transform=_$Transform_448,_$readableBrowser_458.PassThrough=_$PassThrough_446,_$readableBrowser_458.finished=_$eos_453({}),_$readableBrowser_458.pipeline=_$pipeline_455;var _$bn_437={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_437,this),_$bn_437=_$bn_437.exports;var _$browserifyRsa_436={};(function(t){function e(e,i){var n=function(t){var e=r(t);return{blinder:e.toRed(_$bn_437.mont(t.modulus)).redPow(new _$bn_437(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(i),o=i.modulus.byteLength(),a=(_$bn_437.mont(i.modulus),new _$bn_437(e).mul(n.blinder).umod(i.modulus)),s=a.toRed(_$bn_437.mont(i.prime1)),u=a.toRed(_$bn_437.mont(i.prime2)),h=i.coefficient,f=i.prime1,c=i.prime2,l=s.redPow(i.exponent1),_=u.redPow(i.exponent2);l=l.fromRed(),_=_.fromRed();var d=l.isub(_).imul(h).umod(f);return d.imul(c),_.iadd(d),new t(_.imul(n.unblinder).umod(i.modulus).toArray(!1,o))}function r(t){for(var e=t.modulus.byteLength(),r=new _$bn_437(_$browser_558(e));r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new _$bn_437(_$browser_558(e));return r}_$browserifyRsa_436=e,e.getr=r}).call(this,_$buffer_460({}).Buffer);var _$package_497={version:"6.5.3"},_$bn_496={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_496,this),_$bn_496=_$bn_496.exports;var _$utils_537={},__utils_537=_$utils_537;function __zero2_537(t){return 1===t.length?"0"+t:t}function __toHex_537(t){for(var e="",r=0;r>8,a=255&n;o?r.push(o,a):r.push(a)}return r},__utils_537.zero2=__zero2_537,__utils_537.toHex=__toHex_537,__utils_537.encode=function(t,e){return"hex"===e?__toHex_537(t):t};var _$utils_495={},__utils_495=_$utils_495;__utils_495.assert=_$minimalisticAssert_536,__utils_495.toArray=_$utils_537.toArray,__utils_495.zero2=_$utils_537.zero2,__utils_495.toHex=_$utils_537.toHex,__utils_495.encode=_$utils_537.encode,__utils_495.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?(n>>1)-u:u,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},__utils_495.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0;t.cmpn(-i)>0||e.cmpn(-n)>0;){var o,a,s,u=t.andln(3)+i&3,h=e.andln(3)+n&3;3===u&&(u=-1),3===h&&(h=-1),o=0==(1&u)?0:3!=(s=t.andln(7)+i&7)&&5!==s||2!==h?u:-u,r[0].push(o),a=0==(1&h)?0:3!=(s=e.andln(7)+n&7)&&5!==s||2!==u?h:-h,r[1].push(a),2*i===o+1&&(i=1-i),2*n===a+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r},__utils_495.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},__utils_495.parseBytes=function(t){return"string"==typeof t?__utils_495.toArray(t,"hex"):t},__utils_495.intFromLE=function(t){return new _$bn_496(t,"hex","le")};var _$base_482={},__getNAF_482=_$utils_495.getNAF,__getJSF_482=_$utils_495.getJSF;function __BaseCurve_482(t,e){this.type=t,this.p=new _$bn_496(e.p,16),this.red=e.prime?_$bn_496.red(e.prime):_$bn_496.mont(this.p),this.zero=new _$bn_496(0).toRed(this.red),this.one=new _$bn_496(1).toRed(this.red),this.two=new _$bn_496(2).toRed(this.red),this.n=e.n&&new _$bn_496(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 __BasePoint_482(t,e){this.curve=t,this.type=e,this.precomputed=null}_$utils_495.assert,_$base_482=__BaseCurve_482,__BaseCurve_482.prototype.point=function(){throw new Error("Not implemented")},__BaseCurve_482.prototype.validate=function(){throw new Error("Not implemented")},__BaseCurve_482.prototype._fixedNafMul=function(t,e){var r=t._getDoubles(),i=__getNAF_482(e,1,this._bitLength),n=(1<=a;e--)s=(s<<1)+i[e];o.push(s)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=n;f>0;f--){for(a=0;a=0;s--){for(e=0;s>=0&&0===o[s];s--)e++;if(s>=0&&e++,a=a.dblp(e),s<0)break;var u=o[s];a="affine"===t.type?u>0?a.mixedAdd(n[u-1>>1]):a.mixedAdd(n[-u-1>>1].neg()):u>0?a.add(n[u-1>>1]):a.add(n[-u-1>>1].neg())}return"affine"===t.type?a.toP():a},__BaseCurve_482.prototype._wnafMulAdd=function(t,e,r,i,n){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,h=0;h=1;h-=2){var c=h-1,l=h;if(1===o[c]&&1===o[l]){var _=[e[c],null,null,e[l]];0===e[c].y.cmp(e[l].y)?(_[1]=e[c].add(e[l]),_[2]=e[c].toJ().mixedAdd(e[l].neg())):0===e[c].y.cmp(e[l].y.redNeg())?(_[1]=e[c].toJ().mixedAdd(e[l]),_[2]=e[c].add(e[l].neg())):(_[1]=e[c].toJ().mixedAdd(e[l]),_[2]=e[c].toJ().mixedAdd(e[l].neg()));var d=[-3,-1,-5,-7,0,7,5,1,3],p=__getJSF_482(r[c],r[l]);u=Math.max(p[0].length,u),s[c]=new Array(u),s[l]=new Array(u);for(var m=0;m=0;h--){for(var w=0;h>=0;){var M=!0;for(m=0;m=0&&w++,v=v.dblp(w),h<0)break;for(m=0;m0?S=a[m][$-1>>1]:$<0&&(S=a[m][-$-1>>1].neg()),v="affine"===S.type?v.mixedAdd(S):v.add(S))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},__BasePoint_482.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n=0&&(o=e,a=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:n},{a:o,b:a}]},__ShortCurve_486.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),h=o.mul(i.b);return{k1:t.sub(a).sub(s),k2:u.add(h).neg()}},__ShortCurve_486.prototype.pointFromX=function(t,e){(t=new _$bn_496(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},__ShortCurve_486.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},__ShortCurve_486.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},__Point_486.prototype.isInfinity=function(){return this.inf},__Point_486.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},__Point_486.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},__Point_486.prototype.getX=function(){return this.x.fromRed()},__Point_486.prototype.getY=function(){return this.y.fromRed()},__Point_486.prototype.mul=function(t){return t=new _$bn_496(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)},__Point_486.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},__Point_486.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},__Point_486.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))},__Point_486.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},__Point_486.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},_$inherits_browser_530(__JPoint_486,_$base_482.BasePoint),__ShortCurve_486.prototype.jpoint=function(t,e,r){return new __JPoint_486(this,t,e,r)},__JPoint_486.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},__JPoint_486.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},__JPoint_486.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),_=u.redMul(c.redISub(l)).redISub(o.redMul(f)),d=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,_,d)},__JPoint_486.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),_=this.z.redMul(a);return this.curve.jpoint(c,l,_)},__JPoint_486.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(n),0===this.x.cmp(r))return!0}},__JPoint_486.prototype.inspect=function(){return this.isInfinity()?"":""},__JPoint_486.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _$mont_485={};function __MontCurve_485(t){_$base_482.call(this,"mont",t),this.a=new _$bn_496(t.a,16).toRed(this.red),this.b=new _$bn_496(t.b,16).toRed(this.red),this.i4=new _$bn_496(4).toRed(this.red).redInvm(),this.two=new _$bn_496(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function __Point_485(t,e,r){_$base_482.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _$bn_496(e,16),this.z=new _$bn_496(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}_$inherits_browser_530(__MontCurve_485,_$base_482),_$mont_485=__MontCurve_485,__MontCurve_485.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},_$inherits_browser_530(__Point_485,_$base_482.BasePoint),__MontCurve_485.prototype.decodePoint=function(t,e){return this.point(_$utils_495.toArray(t,e),1)},__MontCurve_485.prototype.point=function(t,e){return new __Point_485(this,t,e)},__MontCurve_485.prototype.pointFromJSON=function(t){return __Point_485.fromJSON(this,t)},__Point_485.prototype.precompute=function(){},__Point_485.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},__Point_485.fromJSON=function(t,e){return new __Point_485(t,e[0],e[1]||t.one)},__Point_485.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_485.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},__Point_485.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},__Point_485.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},__Point_485.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=n.redMul(i),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},__Point_485.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},__Point_485.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_485.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_485.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},__Point_485.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},__Point_485.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var _$edwards_483={};function __EdwardsCurve_483(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,_$base_482.call(this,"edwards",t),this.a=new _$bn_496(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _$bn_496(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _$bn_496(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),this.oneC=1==(0|t.c)}function __Point_483(t,e,r,i,n){_$base_482.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _$bn_496(e,16),this.y=new _$bn_496(r,16),this.z=i?new _$bn_496(i,16):this.curve.one,this.t=n&&new _$bn_496(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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}_$utils_495.assert,_$inherits_browser_530(__EdwardsCurve_483,_$base_482),_$edwards_483=__EdwardsCurve_483,__EdwardsCurve_483.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},__EdwardsCurve_483.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},__EdwardsCurve_483.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},__EdwardsCurve_483.prototype.pointFromX=function(t,e){(t=new _$bn_496(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},__EdwardsCurve_483.prototype.pointFromY=function(t,e){(t=new _$bn_496(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(n.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},__EdwardsCurve_483.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},_$inherits_browser_530(__Point_483,_$base_482.BasePoint),__EdwardsCurve_483.prototype.pointFromJSON=function(t){return __Point_483.fromJSON(this,t)},__EdwardsCurve_483.prototype.point=function(t,e,r,i){return new __Point_483(this,t,e,r,i)},__Point_483.fromJSON=function(t,e){return new __Point_483(t,e[0],e[1],e[2])},__Point_483.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_483.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},__Point_483.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),a=o.redSub(r),s=i.redSub(e),u=n.redMul(a),h=o.redMul(s),f=n.redMul(s),c=a.redMul(o);return this.curve.point(u,h,c,f)},__Point_483.prototype._projDbl=function(){var t,e,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(h=this.curve._mulA(n)).redAdd(o);if(this.zOne)t=i.redSub(n).redSub(o).redMul(a.redSub(this.curve.two)),e=a.redMul(h.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);t=i.redSub(n).redISub(o).redMul(u),e=a.redMul(h.redSub(o)),r=a.redMul(u)}}else{var h=n.redAdd(o);s=this.curve._mulC(this.z).redSqr(),u=h.redSub(s).redSub(s),t=this.curve._mulC(i.redISub(h)).redMul(u),e=this.curve._mulC(h).redMul(n.redISub(o)),r=h.redMul(u)}return this.curve.point(t,e,r)},__Point_483.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},__Point_483.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=o.redMul(a),f=s.redMul(u),c=o.redMul(u),l=a.redMul(s);return this.curve.point(h,f,l,c)},__Point_483.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=i.redMul(h).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},__Point_483.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},__Point_483.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},__Point_483.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},__Point_483.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},__Point_483.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},__Point_483.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},__Point_483.prototype.getX=function(){return this.normalize(),this.x.fromRed()},__Point_483.prototype.getY=function(){return this.normalize(),this.y.fromRed()},__Point_483.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},__Point_483.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},__Point_483.prototype.toP=__Point_483.prototype.normalize,__Point_483.prototype.mixedAdd=__Point_483.prototype.add;var _$curve_484={},__curve_484=_$curve_484;__curve_484.base=_$base_482,__curve_484.short=_$short_486,__curve_484.mont=_$mont_485,__curve_484.edwards=_$edwards_483;var _$utils_527={};function __isSurrogatePair_527(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function __htonl_527(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function __zero2_527(t){return 1===t.length?"0"+t:t}function __zero8_527(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}_$utils_527.inherits=_$inherits_browser_530,_$utils_527.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):__isSurrogatePair_527(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return n},_$utils_527.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},_$utils_527.rotr32=function(t,e){return t>>>e|t<<32-e},_$utils_527.rotl32=function(t,e){return t<>>32-e},_$utils_527.sum32=function(t,e){return t+e>>>0},_$utils_527.sum32_3=function(t,e,r){return t+e+r>>>0},_$utils_527.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},_$utils_527.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},_$utils_527.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},_$utils_527.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},_$utils_527.sum64_lo=function(t,e,r,i){return e+i>>>0},_$utils_527.sum64_4_hi=function(t,e,r,i,n,o,a,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},_$utils_527.sum64_4_lo=function(t,e,r,i,n,o,a,s){return e+i+o+s>>>0},_$utils_527.sum64_5_hi=function(t,e,r,i,n,o,a,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},_$utils_527.sum64_5_lo=function(t,e,r,i,n,o,a,s,u,h){return e+i+o+s+h>>>0},_$utils_527.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},_$utils_527.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},_$utils_527.shr64_hi=function(t,e,r){return t>>>r},_$utils_527.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var _$common_517={};function __BlockHash_517(){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}_$common_517.BlockHash=__BlockHash_517,__BlockHash_517.prototype.update=function(t,e){if(t=_$utils_527.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=_$utils_527.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o>>3},_$common_526.g1_256=function(t){return __rotr32_526(t,17)^__rotr32_526(t,19)^t>>>10};var _$1_521={},__rotl32_521=_$utils_527.rotl32,__sum32_521=_$utils_527.sum32,__sum32_5_521=_$utils_527.sum32_5,__ft_1_521=_$common_526.ft_1,__BlockHash_521=_$common_517.BlockHash,__sha1_K_521=[1518500249,1859775393,2400959708,3395469782];function __SHA1_521(){if(!(this instanceof __SHA1_521))return new __SHA1_521;__BlockHash_521.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}_$utils_527.inherits(__SHA1_521,__BlockHash_521),_$1_521=__SHA1_521,__SHA1_521.blockSize=512,__SHA1_521.outSize=160,__SHA1_521.hmacStrength=80,__SHA1_521.padLength=64,__SHA1_521.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest());for(var e=t.length;ethis.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=_$utils_537.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length"};var _$signature_490={};function __Signature_490(t,e){if(t instanceof __Signature_490)return t;this._importDER(t,e)||(this.r=new _$bn_496(t.r,16),this.s=new _$bn_496(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function __Position_490(){this.place=0}function __getLength_490(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,a=e.place;o>>=0;return!(n<=127)&&(e.place=a,n)}function __rmPadding_490(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)}}_$utils_495.assert,_$signature_490=__Signature_490,__Signature_490.prototype._importDER=function(t,e){t=_$utils_495.toArray(t,e);var r=new __Position_490;if(48!==t[r.place++])return!1;var i=__getLength_490(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=__getLength_490(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=__getLength_490(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new _$bn_496(o),this.s=new _$bn_496(s),this.recoveryParam=null,!0},__Signature_490.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=__rmPadding_490(e),r=__rmPadding_490(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];__constructLength_490(i,e.length),(i=i.concat(e)).push(2),__constructLength_490(i,r.length);var n=i.concat(r),o=[48];return __constructLength_490(o,n.length),o=o.concat(n),_$utils_495.encode(o,t)};var _$ec_488={},__KeyPair_488=(_$utils_495.assert,_$key_489);function __EC_488(t){if(!(this instanceof __EC_488))return new __EC_488(t);"string"==typeof t&&(t=_$curves_487[t]),t instanceof _$curves_487.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}_$ec_488=__EC_488,__EC_488.prototype.keyPair=function(t){return new __KeyPair_488(this,t)},__EC_488.prototype.keyFromPrivate=function(t,e){return __KeyPair_488.fromPrivate(this,t,e)},__EC_488.prototype.keyFromPublic=function(t,e){return __KeyPair_488.fromPublic(this,t,e)},__EC_488.prototype.genKeyPair=function(t){t||(t={});for(var e=new _$hmacDrbg_528({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_$brorand_414(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _$bn_496(2));;){var n=new _$bn_496(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},__EC_488.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},__EC_488.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new _$bn_496(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),a=t.toArray("be",n),s=new _$hmacDrbg_528({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new _$bn_496(1)),h=0;;h++){var f=i.k?i.k(h):new _$bn_496(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var c=this.g.mul(f);if(!c.isInfinity()){var l=c.getX(),_=l.umod(this.n);if(0!==_.cmpn(0)){var d=f.invm(this.n).mul(_.mul(e.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var p=(c.getY().isOdd()?1:0)|(0!==l.cmp(_)?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),p^=1),new _$signature_490({r:_,s:d,recoveryParam:p})}}}}}},__EC_488.prototype.verify=function(t,e,r,i){t=this._truncateToN(new _$bn_496(t,16)),r=this.keyFromPublic(r,i);var n=(e=new _$signature_490(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),h=s.mul(n).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(n):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(n)},__EC_488.prototype.recoverPubKey=function(t,e,r,i){e=new _$signature_490(e,i);var n=this.n,o=new _$bn_496(t),a=e.r,s=e.s,u=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=e.r.invm(n),c=n.sub(o).mul(f).umod(n),l=s.mul(f).umod(n);return this.g.mulAdd(c,a,l)},__EC_488.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new _$signature_490(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var _$key_492={},__parseBytes_492=(_$utils_495.assert,_$utils_495.parseBytes),__cachedProperty_492=_$utils_495.cachedProperty;function __KeyPair_492(t,e){this.eddsa=t,this._secret=__parseBytes_492(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=__parseBytes_492(e.pub)}__KeyPair_492.fromPublic=function(t,e){return e instanceof __KeyPair_492?e:new __KeyPair_492(t,{pub:e})},__KeyPair_492.fromSecret=function(t,e){return e instanceof __KeyPair_492?e:new __KeyPair_492(t,{secret:e})},__KeyPair_492.prototype.secret=function(){return this._secret},__cachedProperty_492(__KeyPair_492,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),__cachedProperty_492(__KeyPair_492,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),__cachedProperty_492(__KeyPair_492,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),__cachedProperty_492(__KeyPair_492,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),__cachedProperty_492(__KeyPair_492,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),__cachedProperty_492(__KeyPair_492,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),__KeyPair_492.prototype.sign=function(t){return this.eddsa.sign(t,this)},__KeyPair_492.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},__KeyPair_492.prototype.getSecret=function(t){return _$utils_495.encode(this.secret(),t)},__KeyPair_492.prototype.getPublic=function(t){return _$utils_495.encode(this.pubBytes(),t)},_$key_492=__KeyPair_492;var _$signature_493={},__cachedProperty_493=(_$utils_495.assert,_$utils_495.cachedProperty),__parseBytes_493=_$utils_495.parseBytes;function __Signature_493(t,e){this.eddsa=t,"object"!=typeof e&&(e=__parseBytes_493(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof _$bn_496&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}__cachedProperty_493(__Signature_493,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),__cachedProperty_493(__Signature_493,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),__cachedProperty_493(__Signature_493,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),__cachedProperty_493(__Signature_493,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),__Signature_493.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},__Signature_493.prototype.toHex=function(){return _$utils_495.encode(this.toBytes(),"hex").toUpperCase()},_$signature_493=__Signature_493;var _$eddsa_491={},__parseBytes_491=(_$utils_495.assert,_$utils_495.parseBytes);function __EDDSA_491(t){if(!(this instanceof __EDDSA_491))return new __EDDSA_491(t);t=_$curves_487[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=_$hash_516.sha512}_$eddsa_491=__EDDSA_491,__EDDSA_491.prototype.sign=function(t,e){t=__parseBytes_491(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:o})},__EDDSA_491.prototype.verify=function(t,e,r){t=__parseBytes_491(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},__EDDSA_491.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}function h(){return(this.red?""}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this._strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?n.prototype[Symbol.for("nodejs.util.inspect.custom")]=h:n.prototype.inspect=h;var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function _(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?f[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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=c[t],h=l[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modrn(h).toString(t);r=(_=_.idivn(h)).isZero()?d+r:f[u-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),n=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,r||Math.max(1,i));return this["_toArrayLike"+("le"===e?"LE":"BE")](n,i),n},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),i=0,o=0):(i=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),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function m(t,e,r){return p(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(d=_),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?_(this,t,e):r<1024?p(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},b.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this._strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return e?-i:i},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new $(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function $(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function E(t){$.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},$.prototype._verify1=function(t){},$.prototype._verify2=function(t,e){},$.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},$.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},$.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)},$.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},$.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)},$.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},$.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},$.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},$.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},$.prototype.isqr=function(t){return this.imul(t,t.clone())},$.prototype.sqr=function(t){return this.mul(t,t)},$.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},$.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},$.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},$.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},$.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new E(t)},i(E,$),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_413,this),_$bn_413=_$bn_413.exports;var _$bn_411={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_411,this),_$bn_411=_$bn_411.exports;var _$reporter_402={};function Reporter(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function ReporterError(t,e){this.path=t,this.rethrow(e)}_$reporter_402.Reporter=Reporter,Reporter.prototype.isError=function(t){return t instanceof ReporterError},Reporter.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},Reporter.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},Reporter.prototype.enterKey=function(t){return this._reporterState.path.push(t)},Reporter.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},Reporter.prototype.leaveKey=function(t,e,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},Reporter.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},Reporter.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof ReporterError;if(e=i?t:new ReporterError(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},Reporter.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},_$inherits_browser_530(ReporterError,Error),ReporterError.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var asn=_$asn1_397({}),Time=asn.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),AttributeTypeValue=asn.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),AlgorithmIdentifier=asn.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())})),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",(function(){this.setof(AttributeTypeValue)})),RDNSequence=asn.define("RDNSequence",(function(){this.seqof(RelativeDistinguishedName)})),Name=asn.define("Name",(function(){this.choice({rdnSequence:this.use(RDNSequence)})})),Validity=asn.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))})),Extension=asn.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),TBSCertificate=asn.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())})),X509Certificate=asn.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier),this.key("signatureValue").bitstr())})),_$X509Certificate_540=X509Certificate,_$asn1_539={},__asn1_539=_$asn1_397({});_$asn1_539.certificate=_$X509Certificate_540;var RSAPrivateKey=__asn1_539.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));_$asn1_539.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=__asn1_539.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));_$asn1_539.RSAPublicKey=RSAPublicKey;var PublicKey=__asn1_539.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(__AlgorithmIdentifier_539),this.key("subjectPublicKey").bitstr())}));_$asn1_539.PublicKey=PublicKey;var __AlgorithmIdentifier_539=__asn1_539.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),PrivateKeyInfo=__asn1_539.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(__AlgorithmIdentifier_539),this.key("subjectPrivateKey").octstr())}));_$asn1_539.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=__asn1_539.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));_$asn1_539.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=__asn1_539.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));_$asn1_539.DSAPrivateKey=DSAPrivateKey,_$asn1_539.DSAparam=__asn1_539.define("DSAparam",(function(){this.int()}));var ECPrivateKey=__asn1_539.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())}));_$asn1_539.ECPrivateKey=ECPrivateKey;var ECParameters=__asn1_539.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));_$asn1_539.signature=__asn1_539.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}));var _$aesid_538={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,__Buffer_541=_$safeBuffer_576.Buffer,_$fixProc_541=function(t,e){var r,i=t.toString(),n=i.match(findProc);if(n){var o="aes"+n[1],a=__Buffer_541.from(n[2],"hex"),s=__Buffer_541.from(n[3].replace(/[\r\n]/g,""),"base64"),u=_$evp_bytestokey_499(e,a.slice(0,8),parseInt(n[1],10)).key,h=[],f=_$browser_418.createDecipheriv(o,u,a);h.push(f.update(s)),h.push(f.final()),r=__Buffer_541.concat(h)}else{var c=i.match(fullRegex);r=new __Buffer_541(c[2].replace(/[\r\n]/g,""),"base64")}return{tag:i.match(startRegex)[1],data:r}},_$parseAsn1_542={},__Buffer_542=_$safeBuffer_576.Buffer;function __parseKeys_542(t){var e;"object"!=typeof t||__Buffer_542.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=__Buffer_542.from(t));var r,i,n=_$fixProc_541(t,e),o=n.tag,a=n.data;switch(o){case"CERTIFICATE":i=_$asn1_539.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(i||(i=_$asn1_539.PublicKey.decode(a,"der")),r=i.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return _$asn1_539.RSAPublicKey.decode(i.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return i.subjectPrivateKey=i.subjectPublicKey,{type:"ec",data:i};case"1.2.840.10040.4.1":return i.algorithm.params.pub_key=_$asn1_539.DSAparam.decode(i.subjectPublicKey.data,"der"),{type:"dsa",data:i.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"ENCRYPTED PRIVATE KEY":a=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=_$aesid_538[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,a=t.subjectPrivateKey,s=parseInt(n.split("-")[1],10)/8,u=_$browser_543.pbkdf2Sync(e,r,i,s,"sha1"),h=_$browser_418.createDecipheriv(n,u,o),f=[];return f.push(h.update(a)),f.push(h.final()),__Buffer_542.concat(f)}(a=_$asn1_539.EncryptedPrivateKey.decode(a,"der"),e);case"PRIVATE KEY":switch(r=(i=_$asn1_539.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return _$asn1_539.RSAPrivateKey.decode(i.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:i.algorithm.curve,privateKey:_$asn1_539.ECPrivateKey.decode(i.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return i.algorithm.params.priv_key=_$asn1_539.DSAparam.decode(i.subjectPrivateKey,"der"),{type:"dsa",params:i.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"RSA PUBLIC KEY":return _$asn1_539.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return _$asn1_539.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:_$asn1_539.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=_$asn1_539.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}_$parseAsn1_542=__parseKeys_542,__parseKeys_542.signature=_$asn1_539.signature;var _$curves_440={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},_$sign_442={},__Buffer_442=_$safeBuffer_576.Buffer,__EC_442=_$elliptic_481.ec;function getKey(t,e,r,i){if((t=__Buffer_442.from(t.toArray())).length0&&r.ishrn(i),r}function makeKey(t,e,r){var i,n;do{for(i=__Buffer_442.alloc(0);8*i.length=e)throw new Error("invalid sig")}var _$verify_443=function(t,e,r,i,n){var o=_$parseAsn1_542(r);if("ec"===o.type){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong public key type");return function(t,e,r){var i=_$curves_440[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new __EC_443(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,o)}if("dsa"===o.type){if("dsa"!==i)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,n=r.data.q,o=r.data.g,a=r.data.pub_key,s=_$parseAsn1_542.signature.decode(t,"der"),u=s.s,h=s.r;checkValue(u,n),checkValue(h,n);var f=_$bn_413.mont(i),c=u.invm(n);return 0===o.toRed(f).redPow(new _$bn_413(e).mul(c).mod(n)).fromRed().mul(a.toRed(f).redPow(h.mul(c).mod(n)).fromRed()).mod(i).mod(n).cmp(h)}(t,e,o)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong public key type");e=__Buffer_443.concat([n,e]);for(var a=o.modulus.byteLength(),s=[1],u=0;e.length+s.length+2=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_464,this),_$bn_464=_$bn_464.exports;var _$browser_463={};(function(t){_$browser_463=function(t){return new r(t)};var e={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function r(t){this.curveType=e[t],this.curveType||(this.curveType={name:t}),this.curve=new _$elliptic_481.ec(this.curveType.name),this.keys=void 0}function i(e,r,i){Array.isArray(e)||(e=e.toArray());var n=new t(e);if(i&&n.length=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,P=0|a[7],R=8191&P,I=P>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(R,F)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(R,G)|0,n=(n=n+Math.imul(R,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(R,ut)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Pt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Rt=(h+(i=i+Math.imul(R,dt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Pt,u[16]=Rt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_553,this),_$bn_553=_$bn_553.exports;var __Buffer_556=_$safeBuffer_576.Buffer,_$withPublic_556=function(t,e){return __Buffer_556.from(t.toRed(_$bn_553.mont(e.modulus)).redPow(new _$bn_553(e.publicExponent)).fromRed().toArray())},__Buffer_555=_$safeBuffer_576.Buffer,_$publicEncrypt_555=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=_$parseAsn1_542(t);if(4===i)n=function(t,e){var r=t.modulus.byteLength(),i=e.length,n=_$browser_465("sha1").update(__Buffer_555.alloc(0)).digest(),o=n.length,a=2*o;if(i>r-a-2)throw new Error("message too long");var s=__Buffer_555.alloc(r-i-a-2),u=r-o-1,h=_$browser_558(o),f=_$xor_557(__Buffer_555.concat([n,s,__Buffer_555.alloc(1,1),e],u),_$mgf_552(h,u)),c=_$xor_557(h,_$mgf_552(f,o));return new _$bn_553(__Buffer_555.concat([__Buffer_555.alloc(1),c,f],r))}(o,e);else if(1===i)n=function(t,e,r){var i,n=e.length,o=t.modulus.byteLength();if(n>o-11)throw new Error("message too long");return i=r?__Buffer_555.alloc(o-n-3,255):function(t){for(var e,r=__Buffer_555.allocUnsafe(t),i=0,n=_$browser_558(2*t),o=0;i=0)throw new Error("data too long for modulus")}return r?_$browserifyRsa_436(n,o):_$withPublic_556(n,o)},__Buffer_554=_$safeBuffer_576.Buffer,_$privateDecrypt_554=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=_$parseAsn1_542(t),a=o.modulus.byteLength();if(e.length>a||new _$bn_553(e).cmp(o.modulus)>=0)throw new Error("decryption error");n=r?_$withPublic_556(new _$bn_553(e),o):_$browserifyRsa_436(e,o);var s=__Buffer_554.alloc(a-n.length);if(n=__Buffer_554.concat([s,n],a),4===i)return function(t,e){var r=t.modulus.byteLength(),i=_$browser_465("sha1").update(__Buffer_554.alloc(0)).digest(),n=i.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,n+1),a=e.slice(n+1),s=_$xor_557(o,_$mgf_552(a,n)),u=_$xor_557(a,_$mgf_552(s,r-n-1));if(function(t,e){t=__Buffer_554.from(t),e=__Buffer_554.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));for(var n=-1;++n=e.length){o++;break}var a=e.slice(2,n-1);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return e.slice(n)}(0,n,r);if(3===i)return n;throw new Error("unknown padding")},_$browser_551={};_$browser_551.publicEncrypt=_$publicEncrypt_555,_$browser_551.privateDecrypt=_$privateDecrypt_554,_$browser_551.privateEncrypt=function(t,e){return _$browser_551.publicEncrypt(t,e,!0)},_$browser_551.publicDecrypt=function(t,e){return _$browser_551.privateDecrypt(t,e,!0)};var _$browser_559={};(function(t,e){"use strict";function r(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var i=_$safeBuffer_576.Buffer,n=_$safeBuffer_576.kMaxLength,o=e.crypto||e.msCrypto,a=Math.pow(2,32)-1;function s(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>a||t<0)throw new TypeError("offset must be a uint32");if(t>n||t>e)throw new RangeError("offset out of range")}function u(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>a||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>n)throw new RangeError("buffer too small")}function h(e,r,i,n){if(t.browser){var a=e.buffer,s=new Uint8Array(a,r,i);return o.getRandomValues(s),n?void t.nextTick((function(){n(null,e)})):e}if(!n)return _$browser_558(i).copy(e,r),e;_$browser_558(i,(function(t,i){if(t)return n(t);i.copy(e,r),n(null,e)}))}o&&o.getRandomValues||!t.browser?(_$browser_559.randomFill=function(t,r,n,o){if(!(i.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)o=r,r=0,n=t.length;else if("function"==typeof n)o=n,n=t.length-r;else if("function"!=typeof o)throw new TypeError('"cb" argument must be a function');return s(r,t.length),u(n,r,t.length),h(t,r,n,o)},_$browser_559.randomFillSync=function(t,r,n){if(void 0===r&&(r=0),!(i.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return s(r,t.length),void 0===n&&(n=t.length-r),u(n,r,t.length),h(t,r,n)}):(_$browser_559.randomFill=r,_$browser_559.randomFillSync=r)}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$utils_350={};(function(t,e){const r=_$cryptoBrowserify_469({});function i(t,e,r,i,n,u,h){let f;for(s(t,e+64*(2*i-1),n,0,64),f=0;f<2*i;f++)a(t,64*f,n,0,64),o(n,u,h),s(n,0,t,r+64*f,64);for(f=0;f>>32-e}function o(t,e,r){let i;for(i=0;i<16;i++)e[i]=(255&t[4*i+0])<<0,e[i]|=(255&t[4*i+1])<<8,e[i]|=(255&t[4*i+2])<<16,e[i]|=(255&t[4*i+3])<<24;for(s(e,0,r,0,16),i=8;i>0;i-=2)r[4]^=n(r[0]+r[12],7),r[8]^=n(r[4]+r[0],9),r[12]^=n(r[8]+r[4],13),r[0]^=n(r[12]+r[8],18),r[9]^=n(r[5]+r[1],7),r[13]^=n(r[9]+r[5],9),r[1]^=n(r[13]+r[9],13),r[5]^=n(r[1]+r[13],18),r[14]^=n(r[10]+r[6],7),r[2]^=n(r[14]+r[10],9),r[6]^=n(r[2]+r[14],13),r[10]^=n(r[6]+r[2],18),r[3]^=n(r[15]+r[11],7),r[7]^=n(r[3]+r[15],9),r[11]^=n(r[7]+r[3],13),r[15]^=n(r[11]+r[7],18),r[1]^=n(r[0]+r[3],7),r[2]^=n(r[1]+r[0],9),r[3]^=n(r[2]+r[1],13),r[0]^=n(r[3]+r[2],18),r[6]^=n(r[5]+r[4],7),r[7]^=n(r[6]+r[5],9),r[4]^=n(r[7]+r[6],13),r[5]^=n(r[4]+r[7],18),r[11]^=n(r[10]+r[9],7),r[8]^=n(r[11]+r[10],9),r[9]^=n(r[8]+r[11],13),r[10]^=n(r[9]+r[8],18),r[12]^=n(r[15]+r[14],7),r[13]^=n(r[12]+r[15],9),r[14]^=n(r[13]+r[12],13),r[15]^=n(r[14]+r[13],18);for(i=0;i<16;++i)e[i]=r[i]+e[i];for(i=0;i<16;i++){let r=4*i;t[r+0]=e[i]>>0&255,t[r+1]=e[i]>>8&255,t[r+2]=e[i]>>16&255,t[r+3]=e[i]>>24&255}}function a(t,e,r,i,n){for(let o=0;o 0 and a power of 2");if(n>2147483647/128/o)throw Error("Parameter N is too large");if(o>2147483647/128/a)throw Error("Parameter r is too large");let h,f=t.alloc(256*o),c=t.alloc(128*o*n),l=new Int32Array(16),_=new Int32Array(16),d=t.alloc(64),p=r.pbkdf2Sync(e,i,1,128*a*o,"sha256");if(u){let t=a*n*2,e=0;h=function(){++e%1e3==0&&u({current:e,total:t,percent:e/t*100})}}return{XY:f,V:c,B32:l,x:_,_X:d,B:p,tickCallback:h}},smix:async function(t,r,n,o,s,u,h,f,c,l,_){_=_||5e3;let d,p=128*n;for(t.copy(u,0,r,r+p),d=0;de(t)),i(u,0,p,n,h,f,c),l&&l();for(d=0;de(t)),i(u,0,p,n,h,f,c),l&&l()}u.copy(t,r,0,0+p)},smixSync:function(t,e,r,n,o,s,u,h,f,c){let l,_=128*r;for(t.copy(s,0,e,e+_),l=0;l=0&&(i=!0)})),Object.keys(e).forEach((function(t){r+=o[t]*e[t]})),i&&(r+=2),r+=40,Math.ceil(r/4)}encryptBIP38(t,e){const r=_$wif_393.decode(t);return _$bip38_175.encrypt(r.privateKey,r.compressed,e)}decryptBIP38(t,e,r="mainnet"){const i=_$bip38_175.decrypt(t,e);let n;return n="testnet"===r?239:128,_$wif_393.encode(n,i.privateKey,i.compressed)}},_$crypto_10=class{static sha256(t){return _$src_48.crypto.sha256(t)}static ripemd160(t){return _$src_48.crypto.ripemd160(t)}static hash256(t){return _$src_48.crypto.hash256(t)}static hash160(t){return _$src_48.crypto.hash160(t)}static randomBytes(t=16){return _$browser_342(t)}},_$bind_146=function(t,e){return function(){for(var r=new Array(arguments.length),i=0;i=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},_$isURLSameOrigin_152=_$utils_156.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var i=t;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=_$utils_156.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},_$xhr_131=function(t){return new Promise((function(r,i){var n=t.data,o=t.headers;_$utils_156.isFormData(n)&&delete o["Content-Type"];var a=new XMLHttpRequest;if(t.auth){var s=t.auth.username||"",u=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(s+":"+u)}var h=_$buildFullPath_138(t.baseURL,t.url);if(a.open(t.method.toUpperCase(),_$buildURL_147(h,t.params,t.paramsSerializer),!0),a.timeout=t.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var e="getAllResponseHeaders"in a?_$parseHeaders_154(a.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:e,config:t,request:a};_$settle_143(r,i,n),a=null}},a.onabort=function(){a&&(i(_$createError_139("Request aborted",t,"ECONNABORTED",a)),a=null)},a.onerror=function(){i(_$createError_139("Network Error",t,null,a)),a=null},a.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),i(_$createError_139(e,t,"ECONNABORTED",a)),a=null},_$utils_156.isStandardBrowserEnv()){var f=(t.withCredentials||_$isURLSameOrigin_152(h))&&t.xsrfCookieName?_$cookies_149.read(t.xsrfCookieName):void 0;f&&(o[t.xsrfHeaderName]=f)}if("setRequestHeader"in a&&_$utils_156.forEach(o,(function(t,e){void 0===n&&"content-type"===e.toLowerCase()?delete o[e]:a.setRequestHeader(e,t)})),_$utils_156.isUndefined(t.withCredentials)||(a.withCredentials=!!t.withCredentials),t.responseType)try{a.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&a.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){a&&(a.abort(),i(t),a=null)})),n||(n=null),a.send(n)}))},_$defaults_145={};function throwIfCancellationRequested(t){t.cancelToken&&t.cancelToken.throwIfRequested()}(function(t){"use strict";var r={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!_$utils_156.isUndefined(t)&&_$utils_156.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var n,o={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(n=_$xhr_131),n),transformRequest:[function(t,e){return _$normalizeHeaderName_153(e,"Accept"),_$normalizeHeaderName_153(e,"Content-Type"),_$utils_156.isFormData(t)||_$utils_156.isArrayBuffer(t)||_$utils_156.isBuffer(t)||_$utils_156.isStream(t)||_$utils_156.isFile(t)||_$utils_156.isBlob(t)?t:_$utils_156.isArrayBufferView(t)?t.buffer:_$utils_156.isURLSearchParams(t)?(i(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_$utils_156.isObject(t)?(i(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_$utils_156.forEach(["delete","get","head"],(function(t){o.headers[t]={}})),_$utils_156.forEach(["post","put","patch"],(function(t){o.headers[t]=_$utils_156.merge(r)})),_$defaults_145=o}).call(this,_$browser_550);var _$dispatchRequest_140=function(t){return throwIfCancellationRequested(t),t.headers=t.headers||{},t.data=_$transformData_144(t.data,t.headers,t.transformRequest),t.headers=_$utils_156.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),_$utils_156.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||_$defaults_145.adapter)(t).then((function(e){return throwIfCancellationRequested(t),e.data=_$transformData_144(e.data,e.headers,t.transformResponse),e}),(function(e){return _$isCancel_135(e)||(throwIfCancellationRequested(t),e&&e.response&&(e.response.data=_$transformData_144(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},_$mergeConfig_142=function(t,e){e=e||{};var r={},i=["url","method","data"],n=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(t,e){return _$utils_156.isPlainObject(t)&&_$utils_156.isPlainObject(e)?_$utils_156.merge(t,e):_$utils_156.isPlainObject(e)?_$utils_156.merge({},e):_$utils_156.isArray(e)?e.slice():e}function u(i){_$utils_156.isUndefined(e[i])?_$utils_156.isUndefined(t[i])||(r[i]=s(void 0,t[i])):r[i]=s(t[i],e[i])}_$utils_156.forEach(i,(function(t){_$utils_156.isUndefined(e[t])||(r[t]=s(void 0,e[t]))})),_$utils_156.forEach(n,u),_$utils_156.forEach(o,(function(i){_$utils_156.isUndefined(e[i])?_$utils_156.isUndefined(t[i])||(r[i]=s(void 0,t[i])):r[i]=s(void 0,e[i])})),_$utils_156.forEach(a,(function(i){i in e?r[i]=s(t[i],e[i]):i in t&&(r[i]=s(void 0,t[i]))}));var h=i.concat(n).concat(o).concat(a),f=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===h.indexOf(t)}));return _$utils_156.forEach(f,u),r},_$Axios_136={};function Axios(t){this.defaults=t,this.interceptors={request:new _$InterceptorManager_137,response:new _$InterceptorManager_137}}Axios.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=_$mergeConfig_142(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[_$dispatchRequest_140,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},Axios.prototype.getUri=function(t){return t=_$mergeConfig_142(this.defaults,t),_$buildURL_147(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},_$utils_156.forEach(["delete","get","head","options"],(function(t){Axios.prototype[t]=function(e,r){return this.request(_$mergeConfig_142(r||{},{method:t,url:e,data:(r||{}).data}))}})),_$utils_156.forEach(["post","put","patch"],(function(t){Axios.prototype[t]=function(e,r,i){return this.request(_$mergeConfig_142(i||{},{method:t,url:e,data:r}))}})),_$Axios_136=Axios;var _$Cancel_133={};function Cancel(t){this.message=t}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,_$Cancel_133=Cancel;var _$CancelToken_134={};function CancelToken(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;t((function(t){r.reason||(r.reason=new _$Cancel_133(t),e(r.reason))}))}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},CancelToken.source=function(){var t;return{token:new CancelToken((function(e){t=e})),cancel:t}},_$CancelToken_134=CancelToken;var _$spread_155=function(t){return function(e){return t.apply(null,e)}},_$isAxiosError_151=function(t){return"object"==typeof t&&!0===t.isAxiosError},_$axios_132={};function createInstance(t){var e=new _$Axios_136(t),r=_$bind_146(_$Axios_136.prototype.request,e);return _$utils_156.extend(r,_$Axios_136.prototype,e),_$utils_156.extend(r,e),r}var axios=createInstance(_$defaults_145);axios.Axios=_$Axios_136,axios.create=function(t){return createInstance(_$mergeConfig_142(axios.defaults,t))},axios.Cancel=_$Cancel_133,axios.CancelToken=_$CancelToken_134,axios.isCancel=_$isCancel_135,axios.all=function(t){return Promise.all(t)},axios.spread=_$spread_155,axios.isAxiosError=_$isAxiosError_151,_$axios_132=axios,_$axios_132.default=axios;var _$axios_130=_$axios_132;let _this;var _$util_31=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},_this=this}floor8(t){const e=Number(t);if(isNaN(e))throw new Error("input must be a number");let r=1e8*e;return r=Math.floor(r),r/1e8}floor2(t){const e=Number(t);if(isNaN(e))throw new Error("input must be a number");let r=100*e;return r=Math.floor(r),r/100}chunk20(t){try{if(!Array.isArray(t))throw new Error("input must be an array");let e=0;const r=[];for(;esetTimeout(e,t))}async validateAddress(t){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}util/validateAddress/${t}`,_this.axiosOptions)).data;if(Array.isArray(t)){const e={method:"POST",url:this.restURL+"util/validateAddress",data:{addresses:t},headers:{authorization:"Token "+this.apiToken}};return(await _$axios_130(e)).data}throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}};let ___this_8;var _$blockchain_8=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_8=this}async getBestBlockHash(){try{return(await _$axios_130.get(this.restURL+"blockchain/getBestBlockHash",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlock(t,e=!0){try{return(await _$axios_130.get(`${this.restURL}blockchain/getBlock/${t}?verbose=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getBlockchainInfo(){try{return(await _$axios_130.get(this.restURL+"blockchain/getBlockchainInfo",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlockCount(){try{return(await _$axios_130.get(this.restURL+"blockchain/getBlockCount",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlockHash(t=1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_130.get(`${this.restURL}blockchain/getBlockHash/${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getBlockHeader(t,e=!0){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}blockchain/getBlockHeader/${t}?verbose=${e}`,___this_8.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/getBlockHeader",{hashes:t,verbose:e},___this_8.axiosOptions)).data;throw new Error("Input hash must be a string or array of strings.")}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getChainTips(){try{return(await _$axios_130.get(this.restURL+"blockchain/getChainTips",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getDifficulty(){try{return(await _$axios_130.get(this.restURL+"blockchain/getDifficulty",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getMempoolAncestors(t,e=!1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_130.get(`${this.restURL}blockchain/getMempoolAncestors/${t}?verbose=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getMempoolDescendants(t,e=!1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_130.get(`${this.restURL}blockchain/getMempoolDescendants/${t}?verbose=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getMempoolEntry(t){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}blockchain/getMempoolEntry/${t}`,___this_8.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/getMempoolEntry",{txids:t},___this_8.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getMempoolInfo(){try{return(await _$axios_130.get(this.restURL+"blockchain/getMempoolInfo",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getRawMempool(t=!1){try{return(await _$axios_130.get(`${this.restURL}blockchain/getRawMempool?vebose=${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getTxOut(t,e,r=!0){try{if("string"!=typeof t||64!==t.length)throw new Error("txid needs to be a proper transaction ID");if(isNaN(e))throw new Error("n must be an integer");if("boolean"!=typeof r)throw new Error("includeMempool input must be of type boolean");return(await _$axios_130.post(this.restURL+"blockchain/getTxOut",{txid:t,vout:e,mempool:r},___this_8.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}async getTxOutProof(t){try{if("string"==typeof t){const e=`${this.restURL}blockchain/getTxOutProof/${t}`;return(await _$axios_130.get(e,___this_8.axiosOptions)).data}if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/getTxOutProof",{txids:t},___this_8.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async preciousBlock(t){try{return(await _$axios_130.get(`${this.restURL}blockchain/preciousBlock/${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async pruneBlockchain(t){try{return(await _$axios_130.post(`${this.restURL}blockchain/pruneBlockchain/${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async verifyChain(t=3,e=6){try{return(await _$axios_130.get(`${this.restURL}blockchain/verifyChain?checklevel=${t}&nblocks=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async verifyTxOutProof(t){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}blockchain/verifyTxOutProof/${t}`,___this_8.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/verifyTxOutProof",{proofs:t},___this_8.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}};let ___this_9;var _$control_9=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_9=this}async getNetworkInfo(){try{return(await _$axios_130.get(this.restURL+"control/getNetworkInfo",___this_9.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getMemoryInfo(){try{return(await _$axios_130.get(this.restURL+"control/getMemoryInfo",___this_9.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}};let ___this_14;var _$generating_14=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_14=this}async generateToAddress(t,e,r=1e6){try{return(await _$axios_130.post(`${this.restURL}generating/generateToAddress/${t}/${e}?maxtries=${r}`,___this_14.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}};let ___this_17;var _$mining_17=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_17=this}async getBlockTemplate(t){try{return(await _$axios_130.get(`${this.restURL}mining/getBlockTemplate/${t}`,___this_17.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getMiningInfo(){try{return(await _$axios_130.get(this.restURL+"mining/getMiningInfo",___this_17.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getNetworkHashps(t=120,e=1){try{return(await _$axios_130.get(`${this.restURL}mining/getNetworkHashps?nblocks=${t}&height=${e}`,___this_17.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async submitBlock(t,e){let r=`${this.restURL}mining/submitBlock/${t}`;e&&(r=`${r}?parameters=${e}`);try{return(await _$axios_130.post(r,___this_17.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}},_$bignumber_168={exports:{}};!function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",s=1e14,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e9;function f(t){var e=0|t;return t>0||t===e?e:e-1}function c(t){for(var e,r,i=1,n=t.length,o=t[0]+"";ih^r?1:-1;for(s=(u=n.length)<(h=o.length)?u:h,a=0;ao[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function _(t,e,r,i){if(tr||t!==n(t))throw Error(o+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function d(t){var e=t.c.length-1;return f(t.e/14)==e&&t.c[e]%2!=0}function p(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function m(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eI?d.c=d.e=null:t.e=10;h/=10,u++);return void(u>I?d.c=d.e=null:(d.e=u,d.c=[t]))}l=String(t)}else{if(!r.test(l=String(t)))return v(d,l,f);d.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(u=l.indexOf("."))>-1&&(l=l.replace(".","")),(h=l.search(/e/i))>0?(u<0&&(u=h),u+=+l.slice(h+1),l=l.substring(0,h)):u<0&&(u=l.length)}else{if(_(e,2,U.length,"Base"),10==e)return q(d=new D(t),B+d.e+1,x);if(l=String(t),f="number"==typeof t){if(0*t!=0)return v(d,l,f,e);if(d.s=1/t<0?(l=l.slice(1),-1):1,D.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error(a+t)}else d.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(i=U.slice(0,e),u=h=0,c=l.length;hu){u=c;continue}}else if(!s&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){s=!0,h=-1,u=0;continue}return v(d,String(t),f,e)}f=!1,(u=(l=g(l,e,10,d.s)).indexOf("."))>-1?l=l.replace(".",""):u=l.length}for(h=0;48===l.charCodeAt(h);h++);for(c=l.length;48===l.charCodeAt(--c););if(l=l.slice(h,++c)){if(c-=h,f&&D.DEBUG&&c>15&&(t>9007199254740991||t!==n(t)))throw Error(a+d.s*t);if((u=u-h-1)>I)d.c=d.e=null;else if(u=P)?p(u,a):m(u,a,"0");else if(o=(t=q(new D(t),e,r)).e,s=(u=c(t.c)).length,1==i||2==i&&(e<=o||o<=T)){for(;ss){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-s)>0)for(o+1==s&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function j(t,e){for(var r,i=1,n=new D(t[0]);i=10;n/=10,i++);return(r=i+14*r-1)>I?t.c=t.e=null:r=10;c/=10,a++);if((h=e-a)<0)h+=14,f=e,d=(l=p[_=0])/m[a-f-1]%10|0;else if((_=i((h+1)/14))>=p.length){if(!o)break t;for(;p.length<=_;p.push(0));l=d=0,a=1,f=(h%=14)-14+1}else{for(l=c=p[_],a=1;c>=10;c/=10,a++);d=(f=(h%=14)-14+a)<0?0:l/m[a-f-1]%10|0}if(o=o||e<0||null!=p[_+1]||(f<0?l:l%m[a-f-1]),o=r<4?(d||o)&&(0==r||r==(t.s<0?3:2)):d>5||5==d&&(4==r||o||6==r&&(h>0?f>0?l/m[a-f]:0:p[_-1])%10&1||r==(t.s<0?8:7)),e<1||!p[0])return p.length=0,o?(e-=t.e+1,p[0]=m[(14-e%14)%14],t.e=-e||0):p[0]=t.e=0,t;if(0==h?(p.length=_,c=1,_--):(p.length=_+1,c=m[14-h],p[_]=f>0?n(l/m[a-f]%m[f])*c:0),o)for(;;){if(0==_){for(h=1,f=p[0];f>=10;f/=10,h++);for(f=p[0]+=c,c=1;f>=10;f/=10,c++);h!=c&&(t.e++,p[0]==s&&(p[0]=1));break}if(p[_]+=c,p[_]!=s)break;p[_--]=0,c=1}for(h=p.length;0===p[--h];p.pop());}t.e>I?t.c=t.e=null:t.e=P?p(e,r):m(e,r,"0"),t.s<0?"-"+e:e)}return D.clone=t,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(o+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(_(r=t[e],0,h,e),B=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(_(r=t[e],0,8,e),x=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(_(r[0],-h,0,e),_(r[1],0,h,e),T=r[0],P=r[1]):(_(r,-h,h,e),T=-(P=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)_(r[0],-h,-1,e),_(r[1],1,h,e),R=r[0],I=r[1];else{if(_(r,-h,h,e),!r)throw Error(o+e+" cannot be zero: "+r);R=-(I=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(o+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!r,Error(o+"crypto unavailable");C=r}else C=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(_(r=t[e],0,9,e),O=r),t.hasOwnProperty(e="POW_PRECISION")&&(_(r=t[e],0,h,e),N=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(o+e+" not an object: "+r);L=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(o+e+" invalid: "+r);U=r}}return{DECIMAL_PLACES:B,ROUNDING_MODE:x,EXPONENTIAL_AT:[T,P],RANGE:[R,I],CRYPTO:C,MODULO_MODE:O,POW_PRECISION:N,FORMAT:L,ALPHABET:U}},D.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!D.DEBUG)return!0;var e,r,i=t.c,a=t.e,u=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===u||-1===u)&&a>=-h&&a<=h&&a===n(a)){if(0===i[0]){if(0===a&&1===i.length)return!0;break t}if((e=(a+1)%14)<1&&(e+=14),String(i[0]).length==e){for(e=0;e=s||r!==n(r))break t;if(0!==r)return!0}}}else if(null===i&&null===a&&(null===u||1===u||-1===u))return!0;throw Error(o+"Invalid BigNumber: "+t)},D.maximum=D.max=function(){return j(arguments,k.lt)},D.minimum=D.min=function(){return j(arguments,k.gt)},D.random=(y=9007199254740992*Math.random()&2097151?function(){return n(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,a,s,f,c=0,l=[],d=new D(A);if(null==t?t=B:_(t,0,h),s=i(t/14),C)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(s*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(f%1e14),c+=2);c=s/2}else{if(!crypto.randomBytes)throw C=!1,Error(o+"crypto unavailable");for(e=crypto.randomBytes(s*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(f%1e14),c+=7);c=s/7}if(!C)for(;c=10;f/=10,c++);c<14&&(a-=14-c)}return d.e=a,d.c=l,d}),D.sum=function(){for(var t=1,e=arguments,r=new D(e[0]);tr-1&&(null==a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}return function(e,r,i,n,o){var a,s,u,h,f,l,_,d,p=e.indexOf("."),g=B,v=x;for(p>=0&&(h=N,N=0,e=e.replace(".",""),l=(d=new D(r)).pow(e.length-p),N=h,d.c=t(m(c(l.c),l.e,"0"),10,i,"0123456789"),d.e=d.c.length),u=h=(_=t(e,r,i,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==_[--h];_.pop());if(!_[0])return a.charAt(0);if(p<0?--u:(l.c=_,l.e=u,l.s=n,_=(l=b(l,d,g,v,i)).c,f=l.r,u=l.e),p=_[s=u+g+1],h=i/2,f=f||s<0||null!=_[s+1],f=v<4?(null!=p||f)&&(0==v||v==(l.s<0?3:2)):p>h||p==h&&(4==v||f||6==v&&1&_[s-1]||v==(l.s<0?8:7)),s<1||!_[0])e=f?m(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(_.length=s,f)for(--i;++_[--s]>i;)_[s]=0,s||(++u,_=[1].concat(_));for(h=_.length;!_[--h];);for(p=0,e="";p<=h;e+=a.charAt(_[p++]));e=m(e,u,a.charAt(0))}return e}}(),b=function(){function t(t,e,r){var i,n,o,a,s=0,u=t.length,h=e%1e7,f=e/1e7|0;for(t=t.slice();u--;)s=((n=h*(o=t[u]%1e7)+(i=f*o+(a=t[u]/1e7|0)*h)%1e7*1e7+s)/r|0)+(i/1e7|0)+f*a,t[u]=n%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,i){var n,o;if(r!=i)o=r>i?1:-1;else for(n=o=0;ne[n]?1:-1;break}return o}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,o,a,u,h){var c,l,_,d,p,m,b,g,v,y,w,M,S,$,E,k,A,B=i.s==o.s?1:-1,x=i.c,T=o.c;if(!(x&&x[0]&&T&&T[0]))return new D(i.s&&o.s&&(x?!T||x[0]!=T[0]:T)?x&&0==x[0]||!T?0*B:B/0:NaN);for(v=(g=new D(B)).c=[],B=a+(l=i.e-o.e)+1,h||(h=s,l=f(i.e/14)-f(o.e/14),B=B/14|0),_=0;T[_]==(x[_]||0);_++);if(T[_]>(x[_]||0)&&l--,B<0)v.push(1),d=!0;else{for($=x.length,k=T.length,_=0,B+=2,(p=n(h/(T[0]+1)))>1&&(T=t(T,p,h),x=t(x,p,h),k=T.length,$=x.length),S=k,w=(y=x.slice(0,k)).length;w=h/2&&E++;do{if(p=0,(c=e(T,y,k,w))<0){if(M=y[0],k!=w&&(M=M*h+(y[1]||0)),(p=n(M/E))>1)for(p>=h&&(p=h-1),b=(m=t(T,p,h)).length,w=y.length;1==e(m,y,b,w);)p--,r(m,k=10;B/=10,_++);q(g,a+(g.e=_+14*l-1)+1,u,d)}else g.e=l,g.r=+d;return g}}(),w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,S=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g,v=function(t,e,r,i){var n,a=r?e:e.replace(E,"");if($.test(a))t.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(w,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,a=a.replace(M,"$1").replace(S,"0.$1")),e!=a))return new D(a,n);if(D.DEBUG)throw Error(o+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},k.absoluteValue=k.abs=function(){var t=new D(this);return t.s<0&&(t.s=1),t},k.comparedTo=function(t,e){return l(this,new D(t,e))},k.decimalPlaces=k.dp=function(t,e){var r,i,n,o=this;if(null!=t)return _(t,0,h),null==e?e=x:_(e,0,8),q(new D(o),t+o.e+1,e);if(!(r=o.c))return null;if(i=14*((n=r.length-1)-f(this.e/14)),n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},k.dividedBy=k.div=function(t,e){return b(this,new D(t,e),B,x)},k.dividedToIntegerBy=k.idiv=function(t,e){return b(this,new D(t,e),0,1)},k.exponentiatedBy=k.pow=function(t,e){var r,a,s,u,h,f,c,l,_=this;if((t=new D(t)).c&&!t.isInteger())throw Error(o+"Exponent not an integer: "+F(t));if(null!=e&&(e=new D(e)),h=t.e>14,!_.c||!_.c[0]||1==_.c[0]&&!_.e&&1==_.c.length||!t.c||!t.c[0])return l=new D(Math.pow(+F(_),h?2-d(t):+F(t))),e?l.mod(e):l;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new D(NaN);(a=!f&&_.isInteger()&&e.isInteger())&&(_=_.mod(e))}else{if(t.e>9&&(_.e>0||_.e<-1||(0==_.e?_.c[0]>1||h&&_.c[1]>=24e7:_.c[0]<8e13||h&&_.c[0]<=9999975e7)))return u=_.s<0&&d(t)?-0:0,_.e>-1&&(u=1/u),new D(f?1/u:u);N&&(u=i(N/14+2))}for(h?(r=new D(.5),f&&(t.s=1),c=d(t)):c=(s=Math.abs(+F(t)))%2,l=new D(A);;){if(c){if(!(l=l.times(_)).c)break;u?l.c.length>u&&(l.c.length=u):a&&(l=l.mod(e))}if(s){if(0===(s=n(s/2)))break;c=s%2}else if(q(t=t.times(r),t.e+1,1),t.e>14)c=d(t);else{if(0==(s=+F(t)))break;c=s%2}_=_.times(_),u?_.c&&_.c.length>u&&(_.c.length=u):a&&(_=_.mod(e))}return a?l:(f&&(l=A.div(l)),e?l.mod(e):u?q(l,N,x,void 0):l)},k.integerValue=function(t){var e=new D(this);return null==t?t=x:_(t,0,8),q(e,e.e+1,t)},k.isEqualTo=k.eq=function(t,e){return 0===l(this,new D(t,e))},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(t,e){return l(this,new D(t,e))>0},k.isGreaterThanOrEqualTo=k.gte=function(t,e){return 1===(e=l(this,new D(t,e)))||0===e},k.isInteger=function(){return!!this.c&&f(this.e/14)>this.c.length-2},k.isLessThan=k.lt=function(t,e){return l(this,new D(t,e))<0},k.isLessThanOrEqualTo=k.lte=function(t,e){return-1===(e=l(this,new D(t,e)))||0===e},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&0==this.c[0]},k.minus=function(t,e){var r,i,n,o,a=this,u=a.s;if(e=(t=new D(t,e)).s,!u||!e)return new D(NaN);if(u!=e)return t.s=-e,a.plus(t);var h=a.e/14,c=t.e/14,l=a.c,_=t.c;if(!h||!c){if(!l||!_)return l?(t.s=-e,t):new D(_?a:NaN);if(!l[0]||!_[0])return _[0]?(t.s=-e,t):new D(l[0]?a:3==x?-0:0)}if(h=f(h),c=f(c),l=l.slice(),u=h-c){for((o=u<0)?(u=-u,n=l):(c=h,n=_),n.reverse(),e=u;e--;n.push(0));n.reverse()}else for(i=(o=(u=l.length)<(e=_.length))?u:e,u=e=0;e0)for(;e--;l[r++]=0);for(e=s-1;i>u;){if(l[--i]<_[i]){for(r=i;r&&!l[--r];l[r]=e);--l[r],l[i]+=s}l[i]-=_[i]}for(;0==l[0];l.splice(0,1),--c);return l[0]?H(t,l,c):(t.s=3==x?-1:1,t.c=[t.e=0],t)},k.modulo=k.mod=function(t,e){var r,i,n=this;return t=new D(t,e),!n.c||!t.s||t.c&&!t.c[0]?new D(NaN):!t.c||n.c&&!n.c[0]?new D(n):(9==O?(i=t.s,t.s=1,r=b(n,t,0,3),t.s=i,r.s*=i):r=b(n,t,0,O),(t=n.minus(r.times(t))).c[0]||1!=O||(t.s=n.s),t)},k.multipliedBy=k.times=function(t,e){var r,i,n,o,a,u,h,c,l,_,d,p,m,b,g=this,v=g.c,y=(t=new D(t,e)).c;if(!(v&&y&&v[0]&&y[0]))return!g.s||!t.s||v&&!v[0]&&!y||y&&!y[0]&&!v?t.c=t.e=t.s=null:(t.s*=g.s,v&&y?(t.c=[0],t.e=0):t.c=t.e=null),t;for(i=f(g.e/14)+f(t.e/14),t.s*=g.s,(h=v.length)<(_=y.length)&&(m=v,v=y,y=m,n=h,h=_,_=n),n=h+_,m=[];n--;m.push(0));for(b=s,1e7,n=_;--n>=0;){for(r=0,d=y[n]%1e7,p=y[n]/1e7|0,o=n+(a=h);o>n;)r=((c=d*(c=v[--a]%1e7)+(u=p*c+(l=v[a]/1e7|0)*d)%1e7*1e7+m[o]+r)/b|0)+(u/1e7|0)+p*l,m[o--]=c%b;m[o]=r}return r?++i:m.splice(0,1),H(t,m,i)},k.negated=function(){var t=new D(this);return t.s=-t.s||null,t},k.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new D(t,e)).s,!n||!e)return new D(NaN);if(n!=e)return t.s=-e,i.minus(t);var o=i.e/14,a=t.e/14,u=i.c,h=t.c;if(!o||!a){if(!u||!h)return new D(n/0);if(!u[0]||!h[0])return h[0]?t:new D(u[0]?i:0*n)}if(o=f(o),a=f(a),u=u.slice(),n=o-a){for(n>0?(a=o,r=h):(n=-n,r=u),r.reverse();n--;r.push(0));r.reverse()}for((n=u.length)-(e=h.length)<0&&(r=h,h=u,u=r,e=n),n=0;e;)n=(u[--e]=u[e]+h[e]+n)/s|0,u[e]=s===u[e]?0:u[e]%s;return n&&(u=[n].concat(u),++a),H(t,u,a)},k.precision=k.sd=function(t,e){var r,i,n,o=this;if(null!=t&&t!==!!t)return _(t,1,h),null==e?e=x:_(e,0,8),q(new D(o),t,e);if(!(r=o.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&o.e+1>i&&(i=o.e+1),i},k.shiftedBy=function(t){return _(t,-9007199254740991,9007199254740991),this.times("1e"+t)},k.squareRoot=k.sqrt=function(){var t,e,r,i,n,o=this,a=o.c,s=o.s,u=o.e,h=B+4,l=new D("0.5");if(1!==s||!a||!a[0])return new D(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(s=Math.sqrt(+F(o)))||s==1/0?(((e=c(a)).length+u)%2==0&&(e+="0"),s=Math.sqrt(+e),u=f((u+1)/2)-(u<0||u%2),r=new D(e=s==1/0?"5e"+u:(e=s.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new D(s+""),r.c[0])for((s=(u=r.e)+h)<3&&(s=0);;)if(n=r,r=l.times(n.plus(b(o,n,h,1))),c(n.c).slice(0,s)===(e=c(r.c)).slice(0,s)){if(r.e0&&p>0){for(a=p%u||u,c=d.substr(0,a);a0&&(c+=f+d.slice(a)),_&&(c="-"+c)}i=l?c+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):c}return(r.prefix||"")+i+(r.suffix||"")},k.toFraction=function(t){var e,r,i,n,a,s,h,f,l,_,d,p,m=this,g=m.c;if(null!=t&&(!(h=new D(t)).isInteger()&&(h.c||1!==h.s)||h.lt(A)))throw Error(o+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+F(h));if(!g)return new D(m);for(e=new D(A),l=r=new D(A),i=f=new D(A),p=c(g),a=e.e=p.length-m.e-1,e.c[0]=u[(s=a%14)<0?14+s:s],t=!t||h.comparedTo(e)>0?a>0?e:l:h,s=I,I=1/0,h=new D(p),f.c[0]=0;_=b(h,e,0,1),1!=(n=r.plus(_.times(i))).comparedTo(t);)r=i,i=n,l=f.plus(_.times(n=l)),f=n,e=h.minus(_.times(n=e)),h=n;return n=b(t.minus(r),i,0,1),f=f.plus(n.times(l)),r=r.plus(n.times(i)),f.s=l.s=m.s,d=b(l,i,a*=2,x).minus(m).abs().comparedTo(b(f,r,a,x).minus(m).abs())<1?[l,i]:[f,r],I=s,d},k.toNumber=function(){return+F(this)},k.toPrecision=function(t,e){return null!=t&&_(t,1,h),z(this,t,e,2)},k.toString=function(t){var e,r=this,i=r.s,n=r.e;return null===n?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=n<=T||n>=P?p(c(r.c),n):m(c(r.c),n,"0"):10===t?e=m(c((r=q(new D(r),B+n+1,x)).c),r.e,"0"):(_(t,2,U.length,"Base"),e=g(m(c(r.c),n,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},k.valueOf=k.toJSON=function(){return F(this)},k._isBigNumber=!0,null!=e&&D.set(e),D}()).default=e.BigNumber=e,"function"==typeof define&&define.amd?define((function(){return e})):_$bignumber_168.exports?_$bignumber_168.exports=e:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=e)}(this),_$bignumber_168=_$bignumber_168.exports;var _$dist_369={};(function(t){"use strict";var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$dist_369,"__esModule",{value:!0});const r=e(_$bignumber_168);_$dist_369.BN=r.default,_$dist_369.parseSLP=e=>{"string"==typeof e&&(e=t.from(e,"hex"));let i=0,n=e;const o=(t,e)=>{if(t)throw Error(e)},a=()=>{const t=n.readUInt8(i);return i+=1,new r.default(t)},s=()=>{const t=n.readUInt16LE(i);return i+=2,new r.default(t)},u=()=>{const t=n.readUInt32LE(i);return i+=4,new r.default(t)};o(0===n.length,"scriptpubkey cannot be empty"),o(106!==n[i],"scriptpubkey not op_return"),o(n.length<10,"scriptpubkey too small"),++i;const h=()=>{if(i===n.length)return-1;const t=a().toNumber();return t>0&&t<76?i+t>n.length?(--i,-1):t:76===t?i+1>=n.length?(--i,-1):a().toNumber():77===t?i+2>=n.length?(--i,-1):s().toNumber():78===t?i+4>=n.length?(--i,-1):u().toNumber():(--i,-1)},f=()=>{if(1===n.length)return a();if(2===n.length)return s();if(4===n.length)return u();if(8===n.length)return(()=>{const t=n.readUInt32LE(i);i+=4;const e=n.readUInt32LE(i);return i+=4,new r.default(e).multipliedBy(Math.pow(2,32)).plus(t)})();throw new Error("extraction of number from buffer failed")},c=t=>32===t.length,l=[];for(let t=h();t>=0;t=h()){const e=n.slice(i,i+t);if(o(i+t>n.length,"pushdata data extraction failed"),i+=t,l.push(e),1===l.length){const t=l[0];o(4!==t.length,"lokad id wrong size"),o(t[0]!=="S".charCodeAt(0)||t[1]!=="L".charCodeAt(0)||t[2]!=="P".charCodeAt(0)||0!==t[3],"SLP not in first chunk")}}o(i!==n.length,"trailing data"),o(0===l.length,"chunks empty");let _=0;const d=()=>{o(++_===l.length,"parsing ended early"),i=0,n=l[_]};d();const p=n.reverse();o(1!==p.length&&2!==p.length,"token_type string length must be 1 or 2");const m=f().toNumber();o(![1,65,129].includes(m),"token_type not token-type1, nft1-group, or nft1-child"),d();const b=n.toString();if("GENESIS"===b){o(10!==l.length,"wrong number of chunks"),d();const t=n;d();const e=n;d();const r=n;d();const i=n;o(!(0===i.length||32===i.length),"document_hash must be size 0 or 32"),d(),o(1!==n.length,"decimals string length must be 1");const a=f().toNumber();o(a>9,"decimals bigger than 9"),d();const s=n;let u=0;o(s.length>=2,"mint_baton_vout string length must be 0 or 1"),s.length>0&&(u=f().toNumber(),o(u<2,"mint_baton_vout must be at least 2")),d();const h=n.reverse();o(8!==h.length,"initial_qty must be provided as an 8-byte buffer");const c=f();return 65===m&&(o(0!==a,"NFT1 child token must have divisibility set to 0 decimal places"),o(0!==u,"NFT1 child token must not have a minting baton"),o(!c.isEqualTo(1),"NFT1 child token must have quantity of 1")),{tokenType:m,transactionType:b,data:{ticker:t,name:e,documentUri:r,documentHash:i,decimals:a,mintBatonVout:u,qty:c}}}if("MINT"===b){o(65===m,"NFT1 Child cannot have MINT transaction type."),o(6!==l.length,"wrong number of chunks"),d();const t=n;o(!c(t),"tokenId invalid size"),d();const e=n;let r=0;o(e.length>=2,"mint_baton_vout string length must be 0 or 1"),e.length>0&&(r=f().toNumber(),o(r<2,"mint_baton_vout must be at least 2")),d();const i=n.reverse();return o(8!==i.length,"additional_qty must be provided as an 8-byte buffer"),{tokenType:m,transactionType:b,data:{tokenId:t,mintBatonVout:r,qty:f()}}}if("SEND"===b){o(l.length<4,"wrong number of chunks"),d();const t=n;o(!c(t),"tokenId invalid size"),d();const e=[];for(;_!==l.length;){const t=n.reverse();o(8!==t.length,"amount string size not 8 bytes");const r=f();e.push(r),n=l[++_],i=0}return o(0===e.length,"token_amounts size is 0"),o(e.length>19,"token_amounts size is greater than 19"),{tokenType:m,transactionType:b,data:{tokenId:t,amounts:e}}}return o(!0,"unknown action type"),{tokenType:m,transactionType:b,data:{}}}}).call(this,_$buffer_460({}).Buffer);var _$utils_29={};let ___this_21;(function(t){let e;_$utils_29=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.slpParser=_$dist_369,this.authToken=t.authToken,this.axios=_$axios_130,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},e=this,this.whitelist=[],this.util=new _$util_31(t)}async list(t){let r,i;t?"string"==typeof t?(i="get",r=`${this.restURL}slp/list/${t}`):"object"==typeof t&&(i="post",r=this.restURL+"slp/list"):(i="get",r=this.restURL+"slp/list");try{let n;return(n="get"===i?await e.axios.get(r,e.axiosOptions):await e.axios.post(r,{tokenIds:t},e.axiosOptions)).data}catch(n){if(n.response&&n.response.data)throw n.response.data;throw n}}async balancesForAddress(t){try{if("string"==typeof t){const r=`${this.restURL}slp/balancesForAddress/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}if(Array.isArray(t)){const r=this.restURL+"slp/balancesForAddress";return(await e.axios.post(r,{addresses:t},e.axiosOptions)).data}throw new Error("Input address must be a string or array of strings.")}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async balancesForToken(t){try{const r=`${this.restURL}slp/balancesForToken/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async validateTxid(t,r=null){const i=this.restURL+"slp/validateTxid";let n;n="string"==typeof t?[t]:t;try{return(await e.axios.post(i,{txids:n,usrObj:r},e.axiosOptions)).data}catch(o){if(o.response&&o.response.data)throw o.response.data;throw o}}async validateTxid2(t){try{if(!t||""===t||"string"!=typeof t||64!==t.length)throw new Error("txid must be 64 character string.");const r=`${this.restURL}slp/validateTxid2/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;if(r.error&&r.error.indexOf("Network error")>-1)throw new Error("slp-validate timed out");throw r}}async getWhitelist(){try{const t=this.restURL+"slp/whitelist";if(0===this.whitelist.length){const r=await e.axios.get(t,e.axiosOptions);this.whitelist=r.data}return this.whitelist}catch(t){if(t.response&&t.response.data)throw t.response.data;throw t}}async validateTxid3(t,r=null){const i=this.restURL+"slp/validateTxid3";let n;n="string"==typeof t?[t]:t;try{return(await e.axios.post(i,{txids:n,usrObj:r},e.axiosOptions)).data}catch(o){if(o.response&&o.response.data)throw o.response.data;throw o}}async tokenStats(t){try{const r=`${this.restURL}slp/tokenStats/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async transactions(t,r){try{const i=`${this.restURL}slp/transactions/${t}/${r}`;return(await e.axios.get(i,e.axiosOptions)).data}catch(i){if(i.response&&i.response.data)throw i.response.data;throw i}}async burnTotal(t){try{const r=`${this.restURL}slp/burnTotal/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async txDetails(t){try{if(!t||""===t||"string"!=typeof t||64!==t.length)throw new Error("txid string must be included.");const r=`${this.restURL}slp/txDetails/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async decodeOpReturn(r,i=null,n=null){if(i){if(!(i instanceof Object))throw new Error("decodeOpReturn cache parameter must be Object");const t=i[r];if(t)return t}try{if(!r||""===r||"string"!=typeof r)throw new Error("txid string must be included.");const o=this.restURL+"rawtransactions/getRawTransaction",a=(await e.axios.post(o,{verbose:!0,txids:[r],usrObj:n},e.axiosOptions)).data[0].vout[0].scriptPubKey.hex,s=e.slpParser.parseSLP(t.from(a,"hex"));let u={};return"SEND"===s.transactionType?u={tokenType:s.tokenType,txType:s.transactionType,tokenId:s.data.tokenId.toString("hex"),amounts:s.data.amounts}:"GENESIS"===s.transactionType?u={tokenType:s.tokenType,txType:s.transactionType,ticker:s.data.ticker.toString(),name:s.data.name.toString(),tokenId:r,documentUri:s.data.documentUri.toString(),documentHash:s.data.documentHash.toString(),decimals:s.data.decimals,mintBatonVout:s.data.mintBatonVout,qty:s.data.qty}:"MINT"===s.transactionType&&(u={tokenType:s.tokenType,txType:s.transactionType,tokenId:s.data.tokenId.toString("hex"),mintBatonVout:s.data.mintBatonVout,qty:s.data.qty}),i&&(i[r]=u),u}catch(o){throw o}}async tokenUtxoDetails(t,e=null){try{if(!Array.isArray(t))throw new Error("Input must be an array.");for(let e=0;e__MAX_ALLOC_330||e!=e)throw new TypeError("Bad key length")},_$defaultEncoding_329={};(function(t){var e;e=t.browser?"utf-8":t.version?parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",_$defaultEncoding_329=e}).call(this,_$browser_550);var __Buffer_332=_$safeBuffer_345.Buffer,_$toBuffer_332=function(t,e,r){if(__Buffer_332.isBuffer(t))return t;if("string"==typeof t)return __Buffer_332.from(t,e);if(ArrayBuffer.isView(t))return __Buffer_332.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},_$syncBrowser_331={},__Buffer_331=_$safeBuffer_345.Buffer,__ZEROS_331=__Buffer_331.alloc(128),__sizes_331={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function __Hmac_331(t,e,r){var i=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new _$ripemd160_344).update(t).digest()}:"md5"===t?_$md5_225:function(e){return _$shaJs_358(t).update(e).digest()}}(t),n="sha512"===t||"sha384"===t?128:64;e.length>n?e=i(e):e.lengtho(t.toString(2),"0",8)).join("")}function u(t){const e=8*t.length/32,r=_$browser_224("sha256").update(t).digest();return s(Array.from(r)).slice(0,e)}function h(t){return"mnemonic"+(t||"")}function f(e,s){if(!(s=s||r))throw new Error(i);const h=n(e).split(" ");if(h.length%3!=0)throw new Error("Invalid mnemonic");const f=h.map(t=>{const e=s.indexOf(t);if(-1===e)throw new Error("Invalid mnemonic");return o(e.toString(2),"0",11)}).join(""),c=32*Math.floor(f.length/33),l=f.slice(0,c),_=f.slice(c),d=l.match(/(.{1,8})/g).map(a);if(d.length<16)throw new Error("Invalid entropy");if(d.length>32)throw new Error("Invalid entropy");if(d.length%4!=0)throw new Error("Invalid entropy");const p=t.from(d);if(u(p)!==_)throw new Error("Invalid mnemonic checksum");return p.toString("hex")}function c(e,n){if(t.isBuffer(e)||(e=t.from(e,"hex")),!(n=n||r))throw new Error(i);if(e.length<16)throw new TypeError("Invalid entropy");if(e.length>32)throw new TypeError("Invalid entropy");if(e.length%4!=0)throw new TypeError("Invalid entropy");const o=(s(Array.from(e))+u(e)).match(/(.{1,11})/g).map(t=>{const e=a(t);return n[e]});return"\u3042\u3044\u3053\u304f\u3057\u3093"===n[0]?o.join("\u3000"):o.join(" ")}_$src_177.mnemonicToSeed=function(e,r){return Promise.resolve().then(()=>function(t,e,r,i,n){return Promise.resolve().then(()=>new Promise((r,i)=>{_$browser_327.pbkdf2(t,e,2048,64,"sha512",(t,e)=>t?i(t):r(e))}))}(t.from(n(e),"utf8"),t.from(h(n(r)),"utf8")))},_$src_177.mnemonicToEntropy=f,_$src_177.entropyToMnemonic=c,_$src_177.generateMnemonic=function(t,e,r){if((t=t||128)%32!=0)throw new TypeError("Invalid entropy");return c((e=e||_$browser_342)(t/8),r)},_$src_177.validateMnemonic=function(t,r){try{f(t,r)}catch(e){return!1}return!0},_$src_177.wordlists=_$_wordlists_176.wordlists}).call(this,_$buffer_460({}).Buffer);var _$mnemonic_18={};(function(t){const e=_$safeBuffer_345.Buffer;_$mnemonic_18=class{constructor(t){this._address=t}generate(t=128,e){return _$src_177.generateMnemonic(t,_$browser_342,e)}fromEntropy(t,e){return _$src_177.entropyToMnemonic(t,e)}toEntropy(t,r){return e.from(_$src_177.mnemonicToEntropy(t,r),"hex")}validate(t,e){const r=t.split(" ");if(0===r.length)return"Blank mnemonic";for(let i=0;i(s=i+1)&&(n=s),n>(s=r[a+1]+1)&&(n=s),r[a]=i;r[a]=n}return n},getAsync:function(e,r,i,n){if(n=function(t){const e=Array.prototype.slice.call(arguments,1);for(let r=0;r(f=a+1)&&(s=f),f=o[h+1]+1,s>f&&(s=f),o[h]=a,l=(new Date).valueOf()}if(null!==n.progress)try{n.progress.call(null,100*u/e.length)}catch(err){return i("Progress callback: "+err.toString())}var d;d=_,"function"==typeof t?t(d):setTimeout(d,0)};_()}}}).call(this,_$main_587({}).setImmediate);var _$validation_222={};function ValidationError(t){var e=new Error;this.name=e.name="ValidationError",this.message=e.message=t,this.stack=e.stack}ValidationError.prototype=Object.create(Error.prototype),_$validation_222={ValidationError:ValidationError,validate:function(t,e){if(!t)throw new ValidationError(e)}};var validate=_$validation_222.validate,CHARSET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",CHARSET_INVERSE_INDEX={q:0,p:1,z:2,r:3,y:4,9:5,x:6,8:7,g:8,f:9,2:10,t:11,v:12,d:13,w:14,0:15,s:16,3:17,j:18,n:19,5:20,4:21,k:22,h:23,c:24,e:25,6:26,m:27,u:28,a:29,7:30,l:31},_$base32_219={encode:function(t){validate(t instanceof Uint8Array,"Invalid data: "+t+".");for(var e="",r=0;r0?Math.floor(t):Math.ceil(t)}function d(t,r){var i,n,o=t.length,a=r.length,s=new Array(o),u=0,h=e;for(n=0;n=h?1:0,s[n]=i-u*h;for(;n0&&s.push(u),s}function p(t,e){return t.length>=e.length?d(t,e):d(e,t)}function m(t,r){var i,n,o=t.length,a=new Array(o),s=e;for(n=0;n0;)a[n++]=r%s,r=Math.floor(r/s);return a}function b(t,e){var r,i,n=t.length,o=e.length,a=new Array(n),s=0;for(r=0;r0;)a[n++]=u%s,u=Math.floor(u/s);return a}function w(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function M(t,r,i){return new a(t=0;--r)n=(o=1e7*n+t[r])-(i=_(o/e))*e,s[r]=0|i;return[s,0|n]}function E(t,r){var i,n,u=F(r),d=t.value,p=u.value;if(0===p)throw new Error("Cannot divide by zero");if(t.isSmall)return u.isSmall?[new s(_(d/p)),new s(d%p)]:[o[0],t];if(u.isSmall){if(1===p)return[t,o[0]];if(-1==p)return[t.negate(),o[0]];var m=Math.abs(p);if(m=0;n--){for(i=d-1,g[n+_]!==m&&(i=Math.floor((g[n+_]*d+g[n+_-1])/m)),o=0,a=0,u=v.length,s=0;su&&(n=1e7*(n+1)),r=Math.ceil(n/o);do{if(k(a=y(e,r),l)<=0)break;r--}while(r);h.push(r),l=b(l,a)}return h.reverse(),[f(h),f(l)]}(d,p))[0];var w=t.sign!==u.sign,M=i[1],S=t.sign;return"number"==typeof n?(w&&(n=-n),n=new s(n)):n=new a(n,w),"number"==typeof M?(S&&(M=-M),M=new s(M)):M=new a(M,S),[n,M]}function k(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function A(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function B(t,e){for(var r,i,n,a=t.prev(),s=a,u=0;s.isEven();)s=s.divide(2),u++;t:for(i=0;i=0?i=b(t,e):(i=b(e,t),r=!r),"number"==typeof(i=f(i))?(r&&(i=-i),new s(i)):new a(i,r)}(r,i,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){var e=F(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;return e.isSmall?new s(r-i):g(i,Math.abs(r),r>=0)},s.prototype.minus=s.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var t=this.sign,e=new s(-this.value);return e.sign=!t,e},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},a.prototype.multiply=function(t){var r,i,n,s=F(t),u=this.value,f=s.value,l=this.sign!==s.sign;if(s.isSmall){if(0===f)return o[0];if(1===f)return this;if(-1===f)return this.negate();if((r=Math.abs(f))0?function t(e,r){var i=Math.max(e.length,r.length);if(i<=30)return v(e,r);i=Math.ceil(i/2);var n=e.slice(i),o=e.slice(0,i),a=r.slice(i),s=r.slice(0,i),u=t(o,s),h=t(n,a),f=t(p(o,n),p(s,a)),l=p(p(u,w(b(b(f,u),h),i)),w(h,2*i));return c(l),l}(u,f):v(u,f),l)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(t){return u(t.value*this.value)?new s(t.value*this.value):M(Math.abs(t.value),h(Math.abs(this.value)),this.sign!==t.sign)},a.prototype._multiplyBySmall=function(t){return 0===t.value?o[0]:1===t.value?this:-1===t.value?this.negate():M(Math.abs(t.value),this.value,this.sign!==t.sign)},s.prototype.multiply=function(t){return F(t)._multiplyBySmall(this)},s.prototype.times=s.prototype.multiply,a.prototype.square=function(){return new a(S(this.value),!1)},s.prototype.square=function(){var t=this.value*this.value;return u(t)?new s(t):new a(S(h(Math.abs(this.value))),!1)},a.prototype.divmod=function(t){var e=E(this,t);return{quotient:e[0],remainder:e[1]}},s.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(t){return E(this,t)[0]},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(t){return E(this,t)[1]},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(t){var e,r,i,n=F(t),a=this.value,h=n.value;if(0===h)return o[1];if(0===a)return o[0];if(1===a)return o[1];if(-1===a)return n.isEven()?o[1]:o[-1];if(n.sign)return o[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&u(e=Math.pow(a,h)))return new s(_(e));for(r=this,i=o[1];!0&h&&(i=i.times(r),--h),0!==h;)h/=2,r=r.square();return i},s.prototype.pow=a.prototype.pow,a.prototype.modPow=function(t,e){if(t=F(t),(e=F(e)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var r=o[1],i=this.mod(e);t.isPositive();){if(i.isZero())return o[0];t.isOdd()&&(r=r.multiply(i).mod(e)),t=t.divide(2),i=i.square().mod(e)}return r},s.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(t){var e=F(t),r=this.value,i=e.value;return e.isSmall?1:k(r,i)},s.prototype.compareAbs=function(t){var e=F(t),r=Math.abs(this.value),i=e.value;return e.isSmall?r===(i=Math.abs(i))?0:r>i?1:-1:-1},a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:k(r,i)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return e.isSmall?r==i?0:r>i?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},s.prototype.compareTo=s.prototype.compare,a.prototype.equals=function(t){return 0===this.compare(t)},s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(t){return 0!==this.compare(t)},s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(t){return this.compare(t)>0},s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(t){return this.compare(t)<0},s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},a.prototype.isDivisibleBy=function(t){var e=F(t),r=e.value;return 0!==r&&(1===r||(2===r?this.isEven():this.mod(e).equals(o[0])))},s.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(t){var e=A(this);if(void 0!==e)return e;var r=this.abs(),i=r.bitLength();if(i<=64)return B(r,[2,325,9375,28178,450775,9780504,1795265022]);for(var n=Math.log(2)*i,o=Math.ceil(!0===t?2*Math.pow(n,2):n),a=[],s=0;s-r?new s(t-1):new a(i,!0)};for(var x=[1];2*x[x.length-1]<=e;)x.push(2*x[x.length-1]);var T=x.length,P=x[T-1];function R(t){return("number"==typeof t||"string"==typeof t)&&+Math.abs(t)<=e||t instanceof a&&t.value.length<=1}function I(t,e,r){e=F(e);for(var i=t.isNegative(),n=e.isNegative(),o=i?t.not():t,a=n?e.not():e,s=0,u=0,h=null,f=null,c=[];!o.isZero()||!a.isZero();)s=(h=E(o,P))[1].toJSNumber(),i&&(s=P-1-s),u=(f=E(a,P))[1].toJSNumber(),n&&(u=P-1-u),o=h[0],a=f[0],c.push(r(s,u));for(var l=0!==r(i?1:0,n?1:0)?bigInt(-1):bigInt(0),_=c.length-1;_>=0;_-=1)l=l.multiply(P).add(bigInt(c[_]));return l}a.prototype.shiftLeft=function(t){if(!R(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftRight(-t);var e=this;if(e.isZero())return e;for(;t>=T;)e=e.multiply(P),t-=T-1;return e.multiply(x[t])},s.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(t){var e;if(!R(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftLeft(-t);for(var r=this;t>=T;){if(r.isZero()||r.isNegative()&&r.isUnit())return r;r=(e=E(r,P))[1].isNegative()?e[0].prev():e[0],t-=T-1}return(e=E(r,x[t]))[1].isNegative()?e[0].prev():e[0]},s.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},s.prototype.not=a.prototype.not,a.prototype.and=function(t){return I(this,t,(function(t,e){return t&e}))},s.prototype.and=a.prototype.and,a.prototype.or=function(t){return I(this,t,(function(t,e){return t|e}))},s.prototype.or=a.prototype.or,a.prototype.xor=function(t){return I(this,t,(function(t,e){return t^e}))},s.prototype.xor=a.prototype.xor;function C(t){var r=t.value,i="number"==typeof r?r|1<<30:r[0]+r[1]*e|1073758208;return i&-i}function O(t,e){return t=F(t),e=F(e),t.greater(e)?t:e}function N(t,e){return t=F(t),e=F(e),t.lesser(e)?t:e}function L(t,e){if(t=F(t).abs(),e=F(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=o[1];t.isEven()&&e.isEven();)r=Math.min(C(t),C(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(C(t));do{for(;e.isEven();)e=e.divide(C(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}a.prototype.bitLength=function(){var t=this;return t.compareTo(bigInt(0))<0&&(t=t.negate().subtract(bigInt(1))),0===t.compareTo(bigInt(0))?bigInt(0):bigInt(function t(e,r){if(r.compareTo(e)<=0){var i=t(e,r.square(r)),n=i.p,o=i.e,a=n.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*o+1}:{p:n,e:2*o}}return{p:bigInt(1),e:0}}(t,bigInt(2)).e).add(bigInt(1))},s.prototype.bitLength=a.prototype.bitLength;var U=function(t,e){for(var r=t.length,i=Math.abs(e),o=0;o=i){if("1"===f&&1===i)continue;throw new Error(f+" is not a valid digit in base "+e+".")}if(f.charCodeAt(0)-87>=i)throw new Error(f+" is not a valid digit in base "+e+".")}if(2<=e&&e<=36&&r<=n/Math.log(e)){var a=parseInt(t,e);if(isNaN(a))throw new Error(f+" is not a valid digit in base "+e+".");return new s(parseInt(t,e))}e=F(e);var u=[],h="-"===t[0];for(o=h?1:0;o"!==t[o]);u.push(F(t.slice(l+1,o)))}}return D(u,e,h)};function D(t,e,r){var i,n=o[0],a=o[1];for(i=t.length-1;i>=0;i--)n=n.add(t[i].times(a)),a=a.times(e);return r?n.negate():n}function z(t){return t<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t):"<"+t+">"}function j(t,e){if((e=bigInt(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(+t-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.equals(1))return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+t)).map(Number.prototype.valueOf,1),isNegative:i};for(var n,o=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){n=a.divmod(e),a=n.quotient;var s=n.remainder;s.isNegative()&&(s=e.minus(s).abs(),a=a.next()),o.push(s.toJSNumber())}return o.push(a.toJSNumber()),{value:o.reverse(),isNegative:i}}function H(t,e){var r=j(t,e);return(r.isNegative?"-":"")+r.value.map(z).join("")}function q(t){if(u(+t)){var e=+t;if(e===_(e))return new s(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var i=t.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(2===i.length){var n=i[1];if("+"===n[0]&&(n=n.slice(1)),(n=+n)!==_(n)||!u(n))throw new Error("Invalid integer: "+n+" is not a valid exponent.");var o=i[0],h=o.indexOf(".");if(h>=0&&(n-=o.length-h-1,o=o.slice(0,h)+o.slice(h+1)),n<0)throw new Error("Cannot include negative exponent part for integers");t=o+=new Array(n+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);for(var f=[],l=t.length,d=l-7;l>0;)f.push(+t.slice(d,l)),(d-=7)<0&&(d=0),l-=7;return c(f),new a(f,r)}function F(t){return"number"==typeof t?function(t){if(u(t)){if(t!==_(t))throw new Error(t+" is not an integer.");return new s(t)}return q(t.toString())}(t):"string"==typeof t?q(t):t}a.prototype.toArray=function(t){return j(this,t)},s.prototype.toArray=function(t){return j(this,t)},a.prototype.toString=function(t){if(void 0===t&&(t=10),10!==t)return H(this,t);for(var e,r=this.value,i=r.length,n=String(r[--i]);--i>=0;)e=String(r[i]),n+="0000000".slice(e.length)+e;return(this.sign?"-":"")+n},s.prototype.toString=function(t){return void 0===t&&(t=10),10!=t?H(this,t):String(this.value)},a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=function(){return this.value},s.prototype.toJSNumber=s.prototype.valueOf;for(var K=0;K<1e3;K++)o[K]=new s(K),K>0&&(o[-K]=new s(-K));return o.one=o[1],o.zero=o[0],o.minusOne=o[-1],o.max=O,o.min=N,o.gcd=L,o.lcm=function(t,e){return t=F(t).abs(),e=F(e).abs(),t.divide(L(t,e)).multiply(e)},o.isInstance=function(t){return t instanceof a||t instanceof s},o.randBetween=function(t,r){var i=N(t=F(t),r=F(r)),n=O(t,r).subtract(i).add(1);if(n.isSmall)return i.add(Math.floor(Math.random()*n));for(var o=[],u=!0,h=n.value.length-1;h>=0;h--){var c=u?n.value[h]:e,l=_(Math.random()*c);o.unshift(l),l>e==0,"Invalid value: "+c+"."),u=u<=r;)h-=r,a[s]=u>>h&o,++s}return i?__validate_221(h0&&(a[s]=u<=e?i(void 0,o-n,o):(t.next(),void a()))}))}()},_$chain_35={};function DEFAULT_ADDRESS_FUNCTION(t){return t.getAddress()}function Chain(t,e,r){e=e||0,this.__parent=t,this.addresses=[],this.addressFunction=r||DEFAULT_ADDRESS_FUNCTION,this.k=e,this.map={}}Chain.prototype.__initialize=function(){var t=this.addressFunction(this.__parent.derive(this.k));this.map[t]=this.k,this.addresses.push(t)},Chain.prototype.clone=function(){var t=new Chain(this.__parent,this.k,this.addressFunction);for(var e in t.addresses=this.addresses.concat(),this.map)t.map[e]=this.map[e];return t},Chain.prototype.derive=function(t,e){var r=this.map[t];if(void 0!==r)return(e=e||this.__parent).derive(r)},Chain.prototype.find=function(t){return this.map[t]},Chain.prototype.get=function(){return 0===this.addresses.length&&this.__initialize(),this.addresses[this.addresses.length-1]},Chain.prototype.getAll=function(){return 0===this.addresses.length&&this.__initialize(),this.addresses},Chain.prototype.getParent=function(){return this.__parent},Chain.prototype.next=function(){0===this.addresses.length&&this.__initialize();var t=this.addressFunction(this.__parent.derive(this.k+1));return this.k+=1,this.map[t]=this.k,this.addresses.push(t),t},Chain.prototype.pop=function(){var t=this.addresses.pop();return delete this.map[t],this.k-=1,t},_$chain_35=Chain;var _$account_34={};function Account(t){this.chains=t}Account.fromJSON=function(t,e,r){},Account.prototype.clone=function(){return new Account(this.chains.map((function(t){return t.clone()})))},Account.prototype.containsAddress=function(t){return this.chains.some((function(e){return void 0!==e.find(t)}))},Account.prototype.derive=function(t,e){var r;return this.chains.some((function(i,n){return r=i.derive(t,e&&e[n])})),r},Account.prototype.discoverChain=function(t,e,r,i){var n=this.chains,o=n[t].clone();_$discovery_36(o,e,r,(function(e,r,a){if(e)return i(e);for(var s=a-r,u=1;u0?Math.floor(t):Math.ceil(t)}function p(t,r){var i,n,o=t.length,a=r.length,s=new Array(o),u=0,h=e;for(n=0;n=h?1:0,s[n]=i-u*h;for(;n0&&s.push(u),s}function m(t,e){return t.length>=e.length?p(t,e):p(e,t)}function b(t,r){var i,n,o=t.length,a=new Array(o),s=e;for(n=0;n0;)a[n++]=r%s,r=Math.floor(r/s);return a}function g(t,e){var r,i,n=t.length,o=e.length,a=new Array(n),s=0;for(r=0;r0;)a[n++]=u%s,u=Math.floor(u/s);return a}function M(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function S(t,r,i){return new a(t=0;--r)n=(o=1e7*n+t[r])-(i=d(o/e))*e,s[r]=0|i;return[s,0|n]}function k(t,r){var i,h=F(r);if(n)return[new u(t.value/h.value),new u(t.value%h.value)];var p,m=t.value,b=h.value;if(0===b)throw new Error("Cannot divide by zero");if(t.isSmall)return h.isSmall?[new s(d(m/b)),new s(m%b)]:[o[0],t];if(h.isSmall){if(1===b)return[t,o[0]];if(-1==b)return[t.negate(),o[0]];var v=Math.abs(b);if(v=0;n--){for(i=d-1,g[n+l]!==m&&(i=Math.floor((g[n+l]*d+g[n+l-1])/m)),o=0,a=0,u=v.length,s=0;su&&(n=1e7*(n+1)),r=Math.ceil(n/o);do{if(A(a=w(e,r),f)<=0)break;r--}while(r);h.push(r),f=g(f,a)}return h.reverse(),[c(h),c(f)]}(m,b))[0];var S=t.sign!==h.sign,$=i[1],k=t.sign;return"number"==typeof p?(S&&(p=-p),p=new s(p)):p=new a(p,S),"number"==typeof $?(k&&($=-$),$=new s($)):$=new a($,k),[p,$]}function A(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function B(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function x(t,e){for(var r,i,n,o=t.prev(),a=o,s=0;a.isEven();)a=a.divide(2),s++;t:for(i=0;i=0?i=g(t,e):(i=g(e,t),r=!r),"number"==typeof(i=c(i))?(r&&(i=-i),new s(i)):new a(i,r)}(r,i,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){var e=F(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;return e.isSmall?new s(r-i):v(i,Math.abs(r),r>=0)},s.prototype.minus=s.prototype.subtract,u.prototype.subtract=function(t){return new u(this.value-F(t).value)},u.prototype.minus=u.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var t=this.sign,e=new s(-this.value);return e.sign=!t,e},u.prototype.negate=function(){return new u(-this.value)},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},u.prototype.abs=function(){return new u(this.value>=0?this.value:-this.value)},a.prototype.multiply=function(t){var r,i,n,s=F(t),u=this.value,h=s.value,c=this.sign!==s.sign;if(s.isSmall){if(0===h)return o[0];if(1===h)return this;if(-1===h)return this.negate();if((r=Math.abs(h))0?function t(e,r){var i=Math.max(e.length,r.length);if(i<=30)return y(e,r);i=Math.ceil(i/2);var n=e.slice(i),o=e.slice(0,i),a=r.slice(i),s=r.slice(0,i),u=t(o,s),h=t(n,a),f=t(m(o,n),m(s,a)),c=m(m(u,M(g(g(f,u),h),i)),M(h,2*i));return l(c),c}(u,h):y(u,h),c)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(t){return h(t.value*this.value)?new s(t.value*this.value):S(Math.abs(t.value),f(Math.abs(this.value)),this.sign!==t.sign)},a.prototype._multiplyBySmall=function(t){return 0===t.value?o[0]:1===t.value?this:-1===t.value?this.negate():S(Math.abs(t.value),this.value,this.sign!==t.sign)},s.prototype.multiply=function(t){return F(t)._multiplyBySmall(this)},s.prototype.times=s.prototype.multiply,u.prototype.multiply=function(t){return new u(this.value*F(t).value)},u.prototype.times=u.prototype.multiply,a.prototype.square=function(){return new a($(this.value),!1)},s.prototype.square=function(){var t=this.value*this.value;return h(t)?new s(t):new a($(f(Math.abs(this.value))),!1)},u.prototype.square=function(t){return new u(this.value*this.value)},a.prototype.divmod=function(t){var e=k(this,t);return{quotient:e[0],remainder:e[1]}},u.prototype.divmod=s.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(t){return k(this,t)[0]},u.prototype.over=u.prototype.divide=function(t){return new u(this.value/F(t).value)},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(t){return k(this,t)[1]},u.prototype.mod=u.prototype.remainder=function(t){return new u(this.value%F(t).value)},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(t){var e,r,i,n=F(t),a=this.value,u=n.value;if(0===u)return o[1];if(0===a)return o[0];if(1===a)return o[1];if(-1===a)return n.isEven()?o[1]:o[-1];if(n.sign)return o[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&h(e=Math.pow(a,u)))return new s(d(e));for(r=this,i=o[1];!0&u&&(i=i.times(r),--u),0!==u;)u/=2,r=r.square();return i},s.prototype.pow=a.prototype.pow,u.prototype.pow=function(t){var e=F(t),r=this.value,i=e.value,n=BigInt(0),a=BigInt(1),s=BigInt(2);if(i===n)return o[1];if(r===n)return o[0];if(r===a)return o[1];if(r===BigInt(-1))return e.isEven()?o[1]:o[-1];if(e.isNegative())return new u(n);for(var h=this,f=o[1];(i&a)===a&&(f=f.times(h),--i),i!==n;)i/=s,h=h.square();return f},a.prototype.modPow=function(t,e){if(t=F(t),(e=F(e)).isZero())throw new Error("Cannot take modPow with modulus 0");var r=o[1],i=this.mod(e);for(t.isNegative()&&(t=t.multiply(o[-1]),i=i.modInv(e));t.isPositive();){if(i.isZero())return o[0];t.isOdd()&&(r=r.multiply(i).mod(e)),t=t.divide(2),i=i.square().mod(e)}return r},u.prototype.modPow=s.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(t){var e=F(t),r=this.value,i=e.value;return e.isSmall?1:A(r,i)},s.prototype.compareAbs=function(t){var e=F(t),r=Math.abs(this.value),i=e.value;return e.isSmall?r===(i=Math.abs(i))?0:r>i?1:-1:-1},u.prototype.compareAbs=function(t){var e=this.value,r=F(t).value;return(e=e>=0?e:-e)===(r=r>=0?r:-r)?0:e>r?1:-1},a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:A(r,i)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return e.isSmall?r==i?0:r>i?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},s.prototype.compareTo=s.prototype.compare,u.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=this.value,r=F(t).value;return e===r?0:e>r?1:-1},u.prototype.compareTo=u.prototype.compare,a.prototype.equals=function(t){return 0===this.compare(t)},u.prototype.eq=u.prototype.equals=s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(t){return 0!==this.compare(t)},u.prototype.neq=u.prototype.notEquals=s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(t){return this.compare(t)>0},u.prototype.gt=u.prototype.greater=s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(t){return this.compare(t)<0},u.prototype.lt=u.prototype.lesser=s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},u.prototype.geq=u.prototype.greaterOrEquals=s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},u.prototype.leq=u.prototype.lesserOrEquals=s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},u.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},u.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},u.prototype.isPositive=s.prototype.isPositive,a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},u.prototype.isNegative=s.prototype.isNegative,a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},u.prototype.isUnit=function(){return this.abs().value===BigInt(1)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},u.prototype.isZero=function(){return this.value===BigInt(0)},a.prototype.isDivisibleBy=function(t){var e=F(t);return!e.isZero()&&(!!e.isUnit()||(0===e.compareAbs(2)?this.isEven():this.mod(e).isZero()))},u.prototype.isDivisibleBy=s.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(t){var e=B(this);if(void 0!==e)return e;var r=this.abs(),i=r.bitLength();if(i<=64)return x(r,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var n=Math.log(2)*i.toJSNumber(),o=Math.ceil(!0===t?2*Math.pow(n,2):n),a=[],s=0;s-r?new s(t-1):new a(i,!0)},u.prototype.prev=function(){return new u(this.value-BigInt(1))};for(var T=[1];2*T[T.length-1]<=e;)T.push(2*T[T.length-1]);var P=T.length,R=T[P-1];function I(t){return Math.abs(t)<=e}function C(t,e,r){e=F(e);for(var i=t.isNegative(),n=e.isNegative(),o=i?t.not():t,a=n?e.not():e,s=0,u=0,h=null,f=null,c=[];!o.isZero()||!a.isZero();)s=(h=k(o,R))[1].toJSNumber(),i&&(s=R-1-s),u=(f=k(a,R))[1].toJSNumber(),n&&(u=R-1-u),o=h[0],a=f[0],c.push(r(s,u));for(var l=0!==r(i?1:0,n?1:0)?__bigInt_162(-1):__bigInt_162(0),_=c.length-1;_>=0;_-=1)l=l.multiply(R).add(__bigInt_162(c[_]));return l}a.prototype.shiftLeft=function(t){var e=F(t).toJSNumber();if(!I(e))throw new Error(String(e)+" is too large for shifting.");if(e<0)return this.shiftRight(-e);var r=this;if(r.isZero())return r;for(;e>=P;)r=r.multiply(R),e-=P-1;return r.multiply(T[e])},u.prototype.shiftLeft=s.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(t){var e,r=F(t).toJSNumber();if(!I(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var i=this;r>=P;){if(i.isZero()||i.isNegative()&&i.isUnit())return i;i=(e=k(i,R))[1].isNegative()?e[0].prev():e[0],r-=P-1}return(e=k(i,T[r]))[1].isNegative()?e[0].prev():e[0]},u.prototype.shiftRight=s.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},u.prototype.not=s.prototype.not=a.prototype.not,a.prototype.and=function(t){return C(this,t,(function(t,e){return t&e}))},u.prototype.and=s.prototype.and=a.prototype.and,a.prototype.or=function(t){return C(this,t,(function(t,e){return t|e}))},u.prototype.or=s.prototype.or=a.prototype.or,a.prototype.xor=function(t){return C(this,t,(function(t,e){return t^e}))},u.prototype.xor=s.prototype.xor=a.prototype.xor;function O(t){var r=t.value,i="number"==typeof r?r|1<<30:"bigint"==typeof r?r|BigInt(1<<30):r[0]+r[1]*e|1073758208;return i&-i}function N(t,e){return t=F(t),e=F(e),t.greater(e)?t:e}function L(t,e){return t=F(t),e=F(e),t.lesser(e)?t:e}function U(t,e){if(t=F(t).abs(),e=F(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=o[1];t.isEven()&&e.isEven();)r=L(O(t),O(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(O(t));do{for(;e.isEven();)e=e.divide(O(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}a.prototype.bitLength=function(){var t=this;return t.compareTo(__bigInt_162(0))<0&&(t=t.negate().subtract(__bigInt_162(1))),0===t.compareTo(__bigInt_162(0))?__bigInt_162(0):__bigInt_162(function t(e,r){if(r.compareTo(e)<=0){var i=t(e,r.square(r)),n=i.p,o=i.e,a=n.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*o+1}:{p:n,e:2*o}}return{p:__bigInt_162(1),e:0}}(t,__bigInt_162(2)).e).add(__bigInt_162(1))},u.prototype.bitLength=s.prototype.bitLength=a.prototype.bitLength;var D=function(t,e,r,i){r=r||"0123456789abcdefghijklmnopqrstuvwxyz",t=String(t),i||(t=t.toLowerCase(),r=r.toLowerCase());var n,o=t.length,a=Math.abs(e),s={};for(n=0;n=a){if("1"===f&&1===a)continue;throw new Error(f+" is not a valid digit in base "+e+".")}e=F(e);var u=[],h="-"===t[0];for(n=h?1:0;n"!==t[n]&&n=0;i--)n=n.add(t[i].times(a)),a=a.times(e);return r?n.negate():n}function j(t,e){if((e=__bigInt_162(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(t.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.isUnit())return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(t.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:i};for(var n,o=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){n=a.divmod(e),a=n.quotient;var s=n.remainder;s.isNegative()&&(s=e.minus(s).abs(),a=a.next()),o.push(s.toJSNumber())}return o.push(a.toJSNumber()),{value:o.reverse(),isNegative:i}}function H(t,e,r){var i=j(t,e);return(i.isNegative?"-":"")+i.value.map((function(t){return function(t,e){return t<(e=e||"0123456789abcdefghijklmnopqrstuvwxyz").length?e[t]:"<"+t+">"}(t,r)})).join("")}function q(t){if(h(+t)){var e=+t;if(e===d(e))return n?new u(BigInt(e)):new s(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var i=t.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(2===i.length){var o=i[1];if("+"===o[0]&&(o=o.slice(1)),(o=+o)!==d(o)||!h(o))throw new Error("Invalid integer: "+o+" is not a valid exponent.");var f=i[0],c=f.indexOf(".");if(c>=0&&(o-=f.length-c-1,f=f.slice(0,c)+f.slice(c+1)),o<0)throw new Error("Cannot include negative exponent part for integers");t=f+=new Array(o+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);if(n)return new u(BigInt(r?"-"+t:t));for(var _=[],p=t.length,m=p-7;p>0;)_.push(+t.slice(m,p)),(m-=7)<0&&(m=0),p-=7;return l(_),new a(_,r)}function F(t){return"number"==typeof t?function(t){if(n)return new u(BigInt(t));if(h(t)){if(t!==d(t))throw new Error(t+" is not an integer.");return new s(t)}return q(t.toString())}(t):"string"==typeof t?q(t):"bigint"==typeof t?new u(t):t}a.prototype.toArray=function(t){return j(this,t)},s.prototype.toArray=function(t){return j(this,t)},u.prototype.toArray=function(t){return j(this,t)},a.prototype.toString=function(t,e){if(void 0===t&&(t=10),10!==t)return H(this,t,e);for(var r,i=this.value,n=i.length,o=String(i[--n]);--n>=0;)r=String(i[n]),o+="0000000".slice(r.length)+r;return(this.sign?"-":"")+o},s.prototype.toString=function(t,e){return void 0===t&&(t=10),10!=t?H(this,t,e):String(this.value)},u.prototype.toString=s.prototype.toString,u.prototype.toJSON=a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=function(){return this.value},s.prototype.toJSNumber=s.prototype.valueOf,u.prototype.valueOf=u.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var K=0;K<1e3;K++)o[K]=F(K),K>0&&(o[-K]=F(-K));return o.one=o[1],o.zero=o[0],o.minusOne=o[-1],o.max=N,o.min=L,o.gcd=U,o.lcm=function(t,e){return t=F(t).abs(),e=F(e).abs(),t.divide(U(t,e)).multiply(e)},o.isInstance=function(t){return t instanceof a||t instanceof s||t instanceof u},o.randBetween=function(t,r,i){t=F(t),r=F(r);var n=i||Math.random,a=L(t,r),s=N(t,r).subtract(a).add(1);if(s.isSmall)return a.add(Math.floor(n()*s));for(var u=j(s,e).value,h=[],f=!0,c=0;c>e==0,"Invalid value: "+c+"."),u=u<=r;)h-=r,a[s]=u>>h&o,++s}return i?__validate_216(h0&&(a[s]=u<new _$bip32Utils_37.Chain(t.neutered()));return new _$bip32Utils_37.Account(e)}createChain(t){return new _$bip32Utils_37.Chain(t)}};const SEQUENCE_FINAL=4294967295,SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,SEQUENCE_LOCKTIME_GRANULARITY=9,SEQUENCE_LOCKTIME_MASK=65535,SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,BLOCKS_MAX=SEQUENCE_LOCKTIME_MASK,SECONDS_MOD=1<SECONDS_MAX)throw new TypeError("Expected Number seconds <= "+SECONDS_MAX);if(r%SECONDS_MOD!=0)throw new TypeError("Expected Number seconds as a multiple of "+SECONDS_MOD);return SEQUENCE_LOCKTIME_TYPE_FLAG|r>>SEQUENCE_LOCKTIME_GRANULARITY}if(!Number.isFinite(e))throw new TypeError("Expected Number blocks");if(e>SEQUENCE_LOCKTIME_MASK)throw new TypeError("Expected Number blocks <= "+BLOCKS_MAX);return e}};class __TransactionBuilder_30{static setAddress(t){__TransactionBuilder_30._address=t}constructor(t="mainnet"){let e;const r=(e="bitcoincash"===t||"mainnet"===t?_$coininfo_79.bitcoincash.main:_$coininfo_79.bitcoincash.test).toBitcoinJS();this.transaction=new _$src_48.TransactionBuilder(r),this.DEFAULT_SEQUENCE=4294967295,this.hashTypes={SIGHASH_ALL:1,SIGHASH_NONE:2,SIGHASH_SINGLE:3,SIGHASH_ANYONECANPAY:128,SIGHASH_BITCOINCASH_BIP143:64,ADVANCED_TRANSACTION_MARKER:0,ADVANCED_TRANSACTION_FLAG:1},this.signatureAlgorithms={ECDSA:_$src_48.ECSignature.ECDSA,SCHNORR:_$src_48.ECSignature.SCHNORR},this.bip66=_$bip66_187,this.bip68=_$bcBip68_158,this.p2shInput=!1}addInput(t,e,r=this.DEFAULT_SEQUENCE,i){this.transaction.addInput(t,e,r,i)}addInputScript(t,e){this.tx=this.transaction.buildIncomplete(),this.tx.setInputScript(t,e),this.p2shInput=!0}addInputScripts(t){this.tx=this.transaction.buildIncomplete(),t.forEach(t=>{this.tx.setInputScript(t.vout,t.script)}),this.p2shInput=!0}addOutput(t,e){try{this.transaction.addOutput(__TransactionBuilder_30._address.toLegacyAddress(t),e)}catch(r){this.transaction.addOutput(t,e)}}setLockTime(t){this.transaction.setLockTime(t)}sign(t,e,r,i=this.hashTypes.SIGHASH_ALL,n,o){this.transaction.sign(t,e,r,i,n,void 0,o)}build(){return!0===this.p2shInput?this.tx:this.transaction.build()}}var _$TransactionBuilder_30=__TransactionBuilder_30;class __ECPair_11{static setAddress(t){__ECPair_11._address=t}static fromWIF(t){let e,r;"L"===t[0]||"K"===t[0]?e="mainnet":"c"===t[0]&&(e="testnet");const i=(r="mainnet"===e?_$coininfo_79.bitcoincash.main:_$coininfo_79.bitcoincash.test).toBitcoinJS();return _$src_48.ECPair.fromWIF(t,i)}static toWIF(t){return t.toWIF()}static sign(t,e){return t.sign(e)}static verify(t,e,r){return t.verify(e,r)}static fromPublicKey(t){return _$src_48.ECPair.fromPublicKeyBuffer(t)}static toPublicKey(t){return t.getPublicKeyBuffer()}static toLegacyAddress(t){return t.getAddress()}static toCashAddress(t,e=!1){return __ECPair_11._address.toCashAddress(t.getAddress(),!0,e)}}var _$ECPair_11=__ECPair_11,_$script_23=class{constructor(){this.opcodes=_$index_38,this.nullData=_$src_48.script.nullData,this.multisig={input:{encode:t=>{const e=[];return t.forEach(t=>{e.push(t)}),_$src_48.script.multisig.input.encode(e)},decode:_$src_48.script.multisig.input.decode,check:_$src_48.script.multisig.input.check},output:{encode:(t,e)=>{const r=[];return e.forEach(t=>{r.push(t)}),_$src_48.script.multisig.output.encode(t,r)},decode:_$src_48.script.multisig.output.decode,check:_$src_48.script.multisig.output.check}},this.pubKey=_$src_48.script.pubKey,this.pubKeyHash=_$src_48.script.pubKeyHash,this.scriptHash=_$src_48.script.scriptHash}classifyInput(t){return _$src_48.script.classifyInput(t)}classifyOutput(t){return _$src_48.script.classifyOutput(t)}decode(t){return _$src_48.script.decompile(t)}encode(t){const e=[];return t.forEach(t=>{e.push(t)}),_$src_48.script.compile(e)}encode2(t){const e=[];return t.forEach(t=>{e.push(t)}),_$src_48.script.compile2(e)}toASM(t){return _$src_48.script.toASM(t)}fromASM(t){return _$src_48.script.fromASM(t)}};let ___this_20;var _$price_20=class{constructor(t){___this_20=this,this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.axios=_$axios_130}async current(t="usd"){try{return(await this.axios.get("https://index-api.bitcoin.com/api/v0/cash/price/"+t.toLowerCase())).data.price}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getUsd(){try{return(await this.axios.get(this.restURL+"price/usd",___this_20.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}async rates(){try{return(await this.axios.get(this.restURL+"price/rates",___this_20.axiosOptions)).data}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getBchaUsd(){try{return(await this.axios.get(this.restURL+"price/bchausd",___this_20.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}},_$randomBytes_341={};(function(t){"use strict";var r=_$cryptoBrowserify_469({}),i=r.randomBytes===r.pseudoRandomBytes?1:3;function n(t,e,i){r.randomBytes(t,(function(r,o){return r?--e?void setTimeout(n.bind(null,t,e,i),10):i(r):i(null,o)}))}(_$randomBytes_341=function(e,r){if(void 0!==r&&"function"!=typeof r)throw new TypeError("argument callback must be a function");if(!r&&!t.Promise)throw new TypeError("argument callback is required");return r?n(e,i,r):new Promise((function(t,r){n(e,i,(function(e,i){if(e)return r(e);t(i)}))}))}).sync=function(t){for(var n=null,o=0;o0)throw new Error(t+" must be an integer in the range 1..n-1")}var _$check_169={checkSessionParams:function(t,e,r,i,n){checkSignParams(e,r),checkBuffer("sessionId",t,32),checkBuffer("pubKeyCombined",i,33),checkBuffer("ell",n,32)},checkSignParams:checkSignParams,checkVerifyParams:function(t,e,r){checkBuffer("pubKey",t,33),checkBuffer("message",e,32),checkBuffer("signature",r,64)},checkBatchVerifyParams:function(t,e,r){if(checkPubKeyArr(t),function(t){checkArray("messages",t);for(let e=0;e=0)throw new Error("r is larger than or equal to field size");if(e.compareTo(n)>=0)throw new Error("s is larger than or equal to curve order")},checkPointExists:function(t,e){if(e.curve.isInfinity(e))throw new Error("point is at infinity");if(t!==e.affineY.isEven())throw new Error("point does not exist")},checkPubKeyArr:checkPubKeyArr,checkPubKeysUnique:function(t){const e=t.map(t=>t.toString("hex"));if(t.length!==e.filter((t,e,r)=>r.indexOf(t)===e).length)throw new Error("pubKeys must be an array with unique elements")},checkArray:checkArray,checkNonceArr:function(t){checkArray("nonces",t);for(let e=0;e>6,a[u++]=128|63&o):o<55296||o>=57344?(a[u++]=224|o>>12,a[u++]=128|o>>6&63,a[u++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++i)),a[u++]=240|o>>18,a[u++]=128|o>>12&63,a[u++]=128|o>>6&63,a[u++]=128|63&o);t=a}else{if("object"!==n)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR)}t.length>64&&(t=new Sha256(e,!0).update(t).array());var h=[],f=[];for(i=0;i<64;++i){var c=t[i]||0;h[i]=92^c,f[i]=54^c}Sha256.call(this,e,r),this.update(f),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR);e=!0}for(var i,n,o=0,a=t.length,s=this.blocks;o>2]|=t[o]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[n>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=64?(this.block=s[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t,e,r,i,n,o,a,s,u,h=this.h0,f=this.h1,c=this.h2,l=this.h3,_=this.h4,d=this.h5,p=this.h6,m=this.h7,b=this.blocks;for(t=16;t<64;++t)e=((n=b[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=b[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,b[t]=b[t-16]+e+b[t-7]+r<<0;for(u=f&c,t=0;t<64;t+=4)this.first?(this.is224?(o=300032,m=(n=b[0]-1413257819)-150054599<<0,l=n+24177077<<0):(o=704751109,m=(n=b[0]-210244248)-1521486534<<0,l=n+143694565<<0),this.first=!1):(e=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(o=h&f)^h&c^u,m=l+(n=m+(r=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&d^~_&p)+K[t]+b[t])<<0,l=n+(e+i)<<0),e=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),i=(a=l&h)^l&f^o,p=c+(n=p+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&_^~m&d)+K[t+1]+b[t+1])<<0,e=((c=n+(e+i)<<0)>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),i=(s=c&l)^c&h^a,d=f+(n=d+(r=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&m^~p&_)+K[t+2]+b[t+2])<<0,e=((f=n+(e+i)<<0)>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),i=(u=f&c)^f&l^s,_=h+(n=_+(r=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&p^~d&m)+K[t+3]+b[t+3])<<0,h=n+(e+i)<<0;this.h0=this.h0+h<<0,this.h1=this.h1+f<<0,this.h2=this.h2+c<<0,this.h3=this.h3+l<<0,this.h4=this.h4+_<<0,this.h5=this.h5+d<<0,this.h6=this.h6+p<<0,this.h7=this.h7+m<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,o=this.h5,a=this.h6,s=this.h7,u=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a];return this.is224||(u+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),u},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,o=this.h5,a=this.h6,s=this.h7,u=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||u.push(s>>24&255,s>>16&255,s>>8&255,255&s),u},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?_$sha256_319.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define((function(){return exports})))}()}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$sha256_319=_$sha256_319.exports;const __Buffer_170=_$safeBuffer_345.Buffer,__curve_170=_$lib_268.getCurveByName("secp256k1");function bufferToInt(t){return _$lib_166.fromBuffer(t)}var _$convert_170={bufferToInt:bufferToInt,intToBuffer:function(t){return t.toBuffer(32)},hash:function(t){return __Buffer_170.from(_$sha256_319.create().update(t).array())},pointToBuffer:function(t){return t.getEncoded(!0)},pubKeyToPoint:function(t){const e=t[0]-2==0,r=bufferToInt(t.slice(1,33)),i=__curve_170.pointFromX(!e,r);return _$check_169.checkPointExists(e,i),i}};const __Buffer_172=_$safeBuffer_345.Buffer,__curve_172=_$lib_268.getCurveByName("secp256k1"),__concat_172=__Buffer_172.concat,__G_172=__curve_172.G,__p_172=__curve_172.p,__n_172=__curve_172.n,__one_172=_$lib_166.ONE,__two_172=_$lib_166.valueOf(2);function jacobi(t){return t.modPow(__p_172.subtract(__one_172).divide(__two_172),__p_172).intValue()}var _$math_172={deterministicGetK0:function(t,e){_$check_169.checkSignParams(t,e);const r=_$convert_170.hash(__concat_172([_$convert_170.intToBuffer(t),e])),i=_$convert_170.bufferToInt(r).mod(__n_172);if(0===i.signum())throw new Error("k0 is zero");return i},jacobi:jacobi,getK:function(t,e){return 1===jacobi(t.affineY)?e:__n_172.subtract(e)},getE:function(t,e,r){return _$convert_170.bufferToInt(_$convert_170.hash(__concat_172([t,_$convert_170.pointToBuffer(e),r]))).mod(__n_172)},getR:function(t,e,r){const i=__G_172.multiply(t),n=r.multiply(e);return i.add(n.negate())},randomA:function(){let t=null;for(;;){t=_$convert_170.bufferToInt(__Buffer_172.from(_$randomBytes_341.sync(32)));try{return _$check_169.checkRange("a",t),t}catch(e){}}}};const __Buffer_174=_$safeBuffer_345.Buffer,__curve_174=_$lib_268.getCurveByName("secp256k1"),__concat_174=__Buffer_174.concat,__G_174=__curve_174.G,__p_174=__curve_174.p,__n_174=__curve_174.n,zero=_$lib_166.ZERO,__one_174=_$lib_166.ONE,__two_174=_$lib_166.valueOf(2),three=_$lib_166.valueOf(3),four=_$lib_166.valueOf(4),seven=_$lib_166.valueOf(7);var _$schnorr_174={sign:function(t,e){const r=_$math_172.deterministicGetK0(t,e),i=__G_174.multiply(r),n=_$math_172.getK(i,r),o=__G_174.multiply(t),a=_$convert_170.intToBuffer(i.affineX),s=_$math_172.getE(a,o,e);return __concat_174([a,_$convert_170.intToBuffer(n.add(s.multiply(t)).mod(__n_174))])},verify:function(t,e,r){_$check_169.checkVerifyParams(t,e,r);const i=_$convert_170.pubKeyToPoint(t),n=_$convert_170.bufferToInt(r.slice(0,32)),o=_$convert_170.bufferToInt(r.slice(32,64));_$check_169.checkSignatureInput(n,o);const a=_$math_172.getE(_$convert_170.intToBuffer(n),i,e),s=_$math_172.getR(o,a,i);if(s.curve.isInfinity(s)||1!==_$math_172.jacobi(s.affineY)||!s.affineX.equals(n))throw new Error("signature verification failed")},batchVerify:function(t,e,r){_$check_169.checkBatchVerifyParams(t,e,r);let i=zero,n=null;for(let o=0;o{if(0===e.length)return t.from(Uint8Array.from([76,0]));if(e.length<78)return t.concat([Uint8Array.from([e.length]),e]);if(e.length<255)return t.concat([Uint8Array.from([76,e.length]),e]);if(e.length<65535){const r=t.allocUnsafe(2);return r.writeUInt16LE(e.length,0),t.concat([Uint8Array.from([77]),r,e])}if(e.length<4294967295){const r=t.allocUnsafe(4);return r.writeUInt32LE(e.length,0),t.concat([Uint8Array.from([78]),r,e])}throw new Error("does not support bigger pushes yet")},_$util_368.BNToInt64BE=e=>{if(!e.isInteger())throw new Error("bn not an integer");if(!e.isPositive())throw new Error("bn not positive integer");const r=e.toString(16);if(r.length>16)throw new Error("bn outside of range");return t.from(r.padStart(16,"0"),"hex")},_$util_368.createOpReturnGenesis=(e,r,i,n,o,a,s,u)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof o){if(0!==o.length&&64!==o.length)throw new Error("documentHash must be either 0 or 32 hex bytes");if(64===o.length&&!o.match(/^[0-9a-fA-F]{64}$/))throw new Error("documentHash must be hex");o=t.from(o,"hex")}else if(0!==o.length&&32!==o.length)throw new Error("documentHash must be either 0 or 32 hex bytes");if(a<0||a>9)throw new Error("decimals out of range");if(null!==s&&(s<2||s>255))throw new Error("mintBatonVout out of range (0x02 < > 0xFF)");if(65===e){if(!u.isEqualTo(1))throw new Error("quantity must be 1 for NFT1 child genesis");if(0!==a)throw new Error("decimals must be 0 for NFT1 child genesis");if(null!==s)throw new Error("mintBatonVout must be null for NFT1 child genesis")}return t.concat([Uint8Array.from([106]),_$util_368.pushdata(t.from("SLP\0")),_$util_368.pushdata(Uint8Array.from([e])),_$util_368.pushdata(t.from("GENESIS")),_$util_368.pushdata(t.from(r)),_$util_368.pushdata(t.from(i)),_$util_368.pushdata(t.from(n)),_$util_368.pushdata(o),_$util_368.pushdata(Uint8Array.from([a])),_$util_368.pushdata(Uint8Array.from(null===s?[]:[s])),_$util_368.pushdata(_$util_368.BNToInt64BE(u))])},_$util_368.createOpReturnMint=(e,r,i,n)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof r){if(!r.match(/^[0-9a-fA-F]{64}$/))throw new Error("tokenIdHex does not pass regex");if(64!==r.length)throw new Error("tokenIdHex must be 32 bytes");r=t.from(r,"hex")}else if(32!==r.length)throw new Error("tokenIdHex must be 32 bytes");if(null!==i&&(i<2||i>255))throw new Error("mintBatonVout out of range (0x02 < > 0xFF)");return t.concat([Uint8Array.from([106]),_$util_368.pushdata(t.from("SLP\0")),_$util_368.pushdata(Uint8Array.from([e])),_$util_368.pushdata(t.from("MINT")),_$util_368.pushdata(r),_$util_368.pushdata(Uint8Array.from(null===i?[]:[i])),_$util_368.pushdata(_$util_368.BNToInt64BE(n))])},_$util_368.createOpReturnSend=(e,r,i)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof r){if(!r.match(/^[0-9a-fA-F]{64}$/))throw new Error("tokenIdHex does not pass regex");if(64!==r.length)throw new Error("tokenIdHex must be 32 bytes");r=t.from(r,"hex")}else if(32!==r.length)throw new Error("tokenIdHex must be 32 bytes");if(i.length<1)throw new Error("send requires at least one amount");if(i.length>19)throw new Error("too many slp amounts");return t.concat([Uint8Array.from([106]),_$util_368.pushdata(t.from("SLP\0")),_$util_368.pushdata(Uint8Array.from([e])),_$util_368.pushdata(t.from("SEND")),_$util_368.pushdata(r),...i.map(t=>_$util_368.pushdata(_$util_368.BNToInt64BE(t)))])}}).call(this,_$buffer_460({}).Buffer);var _$tokentype1_367={};Object.defineProperty(_$tokentype1_367,"__esModule",{value:!0}),_$tokentype1_367.default={genesis:(t,e,r,i,n,o,a)=>_$util_368.createOpReturnGenesis(1,t,e,r,i,n,o,a),mint:(t,e,r)=>_$util_368.createOpReturnMint(1,t,e,r),send:(t,e)=>_$util_368.createOpReturnSend(1,t,e)};var _$nft1_366={},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$nft1_366,"__esModule",{value:!0});const bignumber_js_1=__importDefault(_$bignumber_168);_$nft1_366.default={Group:{genesis:(t,e,r,i,n,o,a)=>_$util_368.createOpReturnGenesis(129,t,e,r,i,n,o,a),mint:(t,e,r)=>_$util_368.createOpReturnMint(129,t,e,r),send:(t,e)=>_$util_368.createOpReturnSend(129,t,e)},Child:{genesis:(t,e,r,i)=>_$util_368.createOpReturnGenesis(65,t,e,r,i,0,null,new bignumber_js_1.default(1)),send:(t,e)=>_$util_368.createOpReturnSend(65,t,e)}};var _$dist_365={},____importDefault_365=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$dist_365,"__esModule",{value:!0});const __bignumber_js_1_365=____importDefault_365(_$bignumber_168);_$dist_365.BN=__bignumber_js_1_365.default;const tokentype1_1=____importDefault_365(_$tokentype1_367);_$dist_365.TokenType1=tokentype1_1.default;const nft1_1=____importDefault_365(_$nft1_366);let addy,___this_28;_$dist_365.NFT1=nft1_1.default;var _$tokentype1_28=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},addy=new _$address_24(t),this.Script=new _$script_23,this.axios=_$axios_130,_$TransactionBuilder_30.setAddress(addy),___this_28=this}generateSendOpReturn(t,e){try{const r=t[0].tokenId,i=t[0].decimals,n=new _$bignumber_168(e).times(10**i),o=t.reduce((t,e)=>t.plus(new _$bignumber_168(e.tokenQty).times(10**i)),new _$bignumber_168(0)),a=o.minus(n);let s,u=1;if(a>0){u=2;const t=n.toString(),e=a.toString(),i=new _$bignumber_168(e).plus(new _$bignumber_168(t)),h=new _$bignumber_168(o);if("0"!==i.minus(h).toString())throw new Error("Token transaction inputs do not match outputs, cannot send transaction");s=_$dist_365.TokenType1.send(r,[new _$dist_365.BN(t),new _$dist_365.BN(e)])}else{const t=n.toString(),e=new _$bignumber_168(t),i=new _$bignumber_168(o);if("0"!==e.minus(i).toString())throw new Error("Token transaction inputs do not match outputs, cannot send transaction");s=_$dist_365.TokenType1.send(r,[new _$dist_365.BN(t)])}return{script:s,outputs:u}}catch(err){throw console.log("Error in generateSendOpReturn()"),err}}generateBurnOpReturn(t,e){try{const r=t[0].tokenId,i=t[0].decimals;let n=0;for(let e=0;en&&(e=n);let o=new _$bignumber_168(n-e).times(10**i);return o=o.absoluteValue(),o=(o=Math.floor(o)).toString(),_$dist_365.TokenType1.send(r,[new _$dist_365.BN(o)])}catch(err){throw console.log("Error in generateBurnOpReturn()"),err}}generateGenesisOpReturn(t){try{let e=new _$bignumber_168(t.initialQty).times(10**t.decimals);return e=e.absoluteValue(),e=(e=Math.floor(e)).toString(),t.documentHash||(t.documentHash=""),t.mintBatonVout||(t.mintBatonVout=null),_$dist_365.TokenType1.genesis(t.ticker,t.name,t.documentUrl,t.documentHash,t.decimals,t.mintBatonVout,new _$dist_365.BN(e))}catch(err){throw console.log("Error in generateGenesisOpReturn()"),err}}generateMintOpReturn(t,e,r=!1){try{if(!Array.isArray(t))throw new Error("tokenUtxos must be an array.");let i;for(let e=0;e0){a=2;const t=Math.floor(e).toString(),i=Math.floor(n).toString();o=_$dist_365.NFT1.Child.send(r,[new _$dist_365.BN(t),new _$dist_365.BN(i)])}else{const t=Math.floor(e).toString();o=_$dist_365.NFT1.Child.send(r,[new _$dist_365.BN(t)])}return{script:o,outputs:a}}catch(err){throw console.log("Error in generateNFTChildSendOpReturn()"),err}}generateNFTGroupSendOpReturn(t,e){try{const r=t[0].tokenId;let i=0;for(let e=0;e0){a=2;const t=Math.floor(e).toString(),i=Math.floor(n).toString();o=_$dist_365.NFT1.Group.send(r,[new _$dist_365.BN(t),new _$dist_365.BN(i)])}else{const t=Math.floor(e).toString();o=_$dist_365.NFT1.Group.send(r,[new _$dist_365.BN(t)])}return{script:o,outputs:a}}catch(err){throw console.log("Error in generateNFTGroupSendOpReturn()"),err}}},_$slp_27=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.Address=new _$address_24(t),this.ECPair=_$ecpair_25,this.TokenType1=new _$tokentype1_28(t),this.NFT1=new _$nft1_26(this.restURL),this.Utils=new _$utils_29(t)}},_$hasProperty_125=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e=7&&e<=10},cuid.fingerprint=_$fingerprintBrowser_263,_$cuid_262=cuid;var _$lodashThrottle_320={};(function(t){var e=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,s="object"==typeof self&&self&&self.Object===Object&&self,u=a||s||Function("return this")(),h=Object.prototype.toString,f=Math.max,c=Math.min,l=function(){return u.Date.now()};function _(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function d(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==h.call(t)}(t))return NaN;if(_(t)){var a="function"==typeof t.valueOf?t.valueOf():t;t=_(a)?a+"":a}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(e,"");var s=i.test(t);return s||n.test(t)?o(t.slice(2),s?2:8):r.test(t)?NaN:+t}_$lodashThrottle_320=function(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return _(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),function(t,e,r){var i,n,o,a,s,u,h=0,p=!1,m=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var r=i,o=n;return i=n=void 0,h=e,a=t.apply(o,r)}function v(t){var r=t-u;return void 0===u||r>=e||r<0||m&&t-h>=o}function y(){var t=l();if(v(t))return w(t);s=setTimeout(y,function(t){var r=e-(t-u);return m?c(r,o-(t-h)):r}(t))}function w(t){return s=void 0,b&&i?g(t):(i=n=void 0,a)}function M(){var t=l(),r=v(t);if(i=arguments,n=this,u=t,r){if(void 0===s)return function(t){return h=t,s=setTimeout(y,e),p?g(t):a}(u);if(m)return s=setTimeout(y,e),g(u)}return void 0===s&&(s=setTimeout(y,e)),a}return e=d(e)||0,_(r)&&(p=!!r.leading,o=(m="maxWait"in r)?f(d(r.maxWait)||0,e):o,b="trailing"in r?!!r.trailing:b),M.cancel=function(){void 0!==s&&clearTimeout(s),h=0,i=u=n=s=void 0},M.flush=function(){return void 0===s?a:w(l())},M}(t,e,{leading:i,maxWait:e,trailing:n})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$prettierBytes_98=function(t){if("number"!=typeof t||isNaN(t))throw new TypeError("Expected a number, got "+typeof t);var e=t<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(e&&(t=-t),t<1)return(e?"-":"")+t+" B";var i=Math.min(Math.floor(Math.log(t)/Math.log(1024)),r.length-1);t=Number(t/Math.pow(1024,i));var n=r[i];return t>=10||t%1==0?(e?"-":"")+t.toFixed(0)+" "+n:(e?"-":"")+t.toFixed(1)+" "+n},_$wildcard_394={};function WildcardMatcher(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}WildcardMatcher.prototype.match=function(t){var e,r,i=!0,n=this.parts,o=n.length;if("string"==typeof t||t instanceof String)if(this.hasWild||this.text==t){for(r=(t||"").split(this.separator),e=0;i&&e=2}return e?r(e.split(";")[0]):r},_$lib_110={};function ___extends_110(){return(___extends_110=Object.assign||function(t){for(var e=1;e18||18===i&&n>=18218};function __pad_124(t){return 2!==t.length?0+t:t}var _$getTimeStamp_124=function(){var t=new Date;return __pad_124(t.getHours().toString())+":"+__pad_124(t.getMinutes().toString())+":"+__pad_124(t.getSeconds().toString())},justErrorsLogger={debug:function(){},warn:function(){},error:function(){for(var t,e=arguments.length,r=new Array(e),i=0;i2;)M.push(arguments[a]);for(r&&null!=r.children&&(M.length||M.push(r.children),delete r.children);M.length;)if((n=M.pop())&&void 0!==n.pop)for(a=n.length;a--;)M.push(n[a]);else"boolean"==typeof n&&(n=null),(o="function"!=typeof e)&&(null==n?n="":"number"==typeof n?n=String(n):"string"!=typeof n&&(o=!1)),o&&i?s[s.length-1]+=n:s===S?s=[n]:s.push(n),i=o;var u=new t;return u.nodeName=e,u.children=s,u.attributes=null==r?void 0:r,u.key=null==r?void 0:r.key,void 0!==w.vnode&&w.vnode(u),u}function i(t,e){for(var r in e)t[r]=e[r];return t}function n(t){!t.__d&&(t.__d=!0)&&1==k.push(t)&&(w.debounceRendering||$)(o)}function o(){var t,e=k;for(k=[];t=e.pop();)t.__d&&g(t)}function a(t,e){return t.__n===e||t.nodeName.toLowerCase()===e.toLowerCase()}function s(t){var e=i({},t.attributes);e.children=t.children;var r=t.nodeName.defaultProps;if(void 0!==r)for(var n in r)void 0===e[n]&&(e[n]=r[n]);return e}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function h(t,r,i,n,o){if("className"===r&&(r="class"),"key"===r);else if("ref"===r)i&&i(null),n&&n(t);else if("class"!==r||o)if("style"===r){if(n&&"string"!=typeof n&&"string"!=typeof i||(t.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof i)for(var a in i)a in n||(t.style[a]="");for(var a in n)t.style[a]="number"==typeof n[a]&&!1===E.test(a)?n[a]+"px":n[a]}}else if("dangerouslySetInnerHTML"===r)n&&(t.innerHTML=n.__html||"");else if("o"==r[0]&&"n"==r[1]){var s=r!==(r=r.replace(/Capture$/,""));r=r.toLowerCase().substring(2),n?i||t.addEventListener(r,f,s):t.removeEventListener(r,f,s),(t.__l||(t.__l={}))[r]=n}else if("list"!==r&&"type"!==r&&!o&&r in t)!function(t,r,i){try{t[r]=i}catch(e){}}(t,r,null==n?"":n),null!=n&&!1!==n||t.removeAttribute(r);else{var u=o&&r!==(r=r.replace(/^xlink:?/,""));null==n||!1===n?u?t.removeAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase()):t.removeAttribute(r):"function"!=typeof n&&(u?t.setAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase(),n):t.setAttribute(r,n))}else t.className=n||""}function f(t){return this.__l[t.type](w.event&&w.event(t)||t)}function c(){for(var t;t=A.pop();)w.afterMount&&w.afterMount(t),t.componentDidMount&&t.componentDidMount()}function l(t,e,r,i,n,o){B++||(x=null!=n&&void 0!==n.ownerSVGElement,T=null!=t&&!("__preactattr_"in t));var f=function t(e,r,i,n,o){var f=e,c=x;if(null!=r&&"boolean"!=typeof r||(r=""),"string"==typeof r||"number"==typeof r)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=r&&(e.nodeValue=r):(f=document.createTextNode(r),e&&(e.parentNode&&e.parentNode.replaceChild(f,e),_(e,!0))),f.__preactattr_=!0,f;var l,d,m=r.nodeName;if("function"==typeof m)return function(t,e,r,i){for(var n=t&&t._component,o=n,a=t,u=n&&t._componentConstructor===e.nodeName,h=u,f=s(e);n&&!h&&(n=n.__u);)h=n.constructor===e.nodeName;return n&&h&&(!i||n._component)?(b(n,f,3,r,i),t=n.base):(o&&!u&&(v(o),t=a=null),n=p(e.nodeName,f,r),t&&!n.__b&&(n.__b=t,a=null),b(n,f,1,r,i),t=n.base,a&&t!==a&&(a._component=null,_(a,!1))),t}(e,r,i,n);if(x="svg"===m||"foreignObject"!==m&&x,m=String(m),(!e||!a(e,m))&&(l=m,(d=x?document.createElementNS("http://www.w3.org/2000/svg",l):document.createElement(l)).__n=l,f=d,e)){for(;e.firstChild;)f.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(f,e),_(e,!0)}var g=f.firstChild,y=f.__preactattr_,w=r.children;if(null==y){y=f.__preactattr_={};for(var M=f.attributes,S=M.length;S--;)y[M[S].name]=M[S].value}return!T&&w&&1===w.length&&"string"==typeof w[0]&&null!=g&&void 0!==g.splitText&&null==g.nextSibling?g.nodeValue!=w[0]&&(g.nodeValue=w[0]):(w&&w.length||null!=g)&&function(e,r,i,n,o){var s,h,f,c,l,d,p,m,b=e.childNodes,g=[],v={},y=0,w=0,M=b.length,S=0,$=r?r.length:0;if(0!==M)for(var E=0;E2?[].slice.call(arguments,2):t.children)},Component:y,render:function(t,e,r){return l(r,t,{},!1,e,!1)},rerender:o,options:w};_$preact_333.exports=R}(),_$preact_333=_$preact_333.exports;var _$isDOMElement_126=function(t){return t&&"object"==typeof t&&t.nodeType===Node.ELEMENT_NODE},_$findDOMElement_119=function(t,e){return void 0===e&&(e=document),"string"==typeof t?e.querySelector(t):_$isDOMElement_126(t)?t:void 0};function ___extends_106(){return(___extends_106=Object.assign||function(t){for(var e=1;e tag initializing Uppy is right before the closing tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.")},e.render=function(t){throw new Error("Extend the render method to add your plugin to a DOM element")},e.addTarget=function(t){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},e.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.install=function(){},e.uninstall=function(){this.unmount()},t}(),_$lib_107={};function ___extends_107(){return(___extends_107=Object.assign||function(t){for(var e=1;ea)throw new RestrictionError(""+this.i18n("youCanOnlyUploadX",{smart_count:a}));if(s&&!s.some((function(e){return e.indexOf("/")>-1?!!t.type&&_$mimeMatch_323(t.type.replace(/;.*?$/,""),e):!("."!==e[0]||!t.extension)&&t.extension.toLowerCase()===e.substr(1).toLowerCase()}))){var u=s.join(", ");throw new RestrictionError(this.i18n("youCanOnlyUploadFileTypes",{types:u}))}if(o&&null!=t.size){var h=0;if(h+=t.size,e.forEach((function(t){h+=t.size})),h>o)throw new RestrictionError(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:_$prettierBytes_98(o)}))}if(i&&null!=t.size&&t.size>i)throw new RestrictionError(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:_$prettierBytes_98(i)}));if(n&&null!=t.size&&t.size5?this.log("Added batch of "+i.length+" files"):Object.keys(i).forEach((function(t){e.log("Added file: "+i[t].name+"\n id: "+i[t].id+"\n type: "+i[t].type)})),i.length>0&&this._startIfAutoProceed(),n.length>0){var s="Multiple errors occurred while adding files:\n";n.forEach((function(t){s+="\n * "+t.message})),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:n.length}),details:s},"error",this.opts.infoTimeout);var u=new Error(s);throw u.errors=n,u}},i.removeFiles=function(t,e){var r=this,i=this.getState(),n=i.files,o=i.currentUploads,a=___extends_107({},n),s=___extends_107({},o),u=Object.create(null);function h(t){return void 0===u[t]}t.forEach((function(t){n[t]&&(u[t]=n[t],delete a[t])}));var f=[];Object.keys(s).forEach((function(t){var e=o[t].fileIDs.filter(h);0!==e.length?s[t]=___extends_107({},o[t],{fileIDs:e}):f.push(t)})),f.forEach((function(t){delete s[t]}));var c={currentUploads:s,files:a};0===Object.keys(a).length&&(c.allowNewUpload=!0,c.error=null),this.setState(c),this._calculateTotalProgress();var l=Object.keys(u);l.forEach((function(t){r.emit("file-removed",u[t],e)})),l.length>5?this.log("Removed "+l.length+" files"):this.log("Removed files: "+l.join(", "))},i.removeFile=function(t,e){void 0===e&&(e=null),this.removeFiles([t],e)},i.pauseResume=function(t){if(this.getState().capabilities.resumableUploads&&!this.getFile(t).uploadComplete){var e=!this.getFile(t).isPaused;return this.setFileState(t,{isPaused:e}),this.emit("upload-pause",t,e),e}},i.pauseAll=function(){var t=___extends_107({},this.getState().files);Object.keys(t).filter((function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted})).forEach((function(e){var r=___extends_107({},t[e],{isPaused:!0});t[e]=r})),this.setState({files:t}),this.emit("pause-all")},i.resumeAll=function(){var t=___extends_107({},this.getState().files);Object.keys(t).filter((function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted})).forEach((function(e){var r=___extends_107({},t[e],{isPaused:!1,error:null});t[e]=r})),this.setState({files:t}),this.emit("resume-all")},i.retryAll=function(){var t=___extends_107({},this.getState().files),e=Object.keys(t).filter((function(e){return t[e].error}));if(e.forEach((function(e){var r=___extends_107({},t[e],{isPaused:!1,error:null});t[e]=r})),this.setState({files:t,error:null}),this.emit("retry-all",e),0===e.length)return Promise.resolve({successful:[],failed:[]});var r=this._createUpload(e,{forceAllowNewUpload:!0});return this._runUpload(r)},i.cancelAll=function(){this.emit("cancel-all");var t=this.getState().files,e=Object.keys(t);e.length&&this.removeFiles(e,"cancel-all"),this.setState({totalProgress:0,error:null})},i.retryUpload=function(t){this.setFileState(t,{error:null,isPaused:!1}),this.emit("upload-retry",t);var e=this._createUpload([t],{forceAllowNewUpload:!0});return this._runUpload(e)},i.reset=function(){this.cancelAll()},i._calculateProgress=function(t,e){if(this.getFile(t.id)){var r=isFinite(e.bytesTotal)&&e.bytesTotal>0;this.setFileState(t.id,{progress:___extends_107({},this.getFile(t.id).progress,{bytesUploaded:e.bytesUploaded,bytesTotal:e.bytesTotal,percentage:r?Math.round(e.bytesUploaded/e.bytesTotal*100):0})}),this._calculateTotalProgress()}else this.log("Not setting progress for a file that has been removed: "+t.id)},i._calculateTotalProgress=function(){var t=this.getFiles().filter((function(t){return t.progress.uploadStarted||t.progress.preprocess||t.progress.postprocess}));if(0===t.length)return this.emit("progress",0),void this.setState({totalProgress:0});var e=t.filter((function(t){return null!=t.progress.bytesTotal})),r=t.filter((function(t){return null==t.progress.bytesTotal}));if(0!==e.length){var i=e.reduce((function(t,e){return t+e.progress.bytesTotal}),0),n=i/e.length;i+=n*r.length;var o=0;e.forEach((function(t){o+=t.progress.bytesUploaded})),r.forEach((function(t){o+=n*(t.progress.percentage||0)/100}));var a=0===i?0:Math.round(o/i*100);a>100&&(a=100),this.setState({totalProgress:a}),this.emit("progress",a)}else{var s=100*t.length,u=r.reduce((function(t,e){return t+e.progress.percentage}),0),h=Math.round(u/s*100);this.setState({totalProgress:h})}},i._addListeners=function(){var t=this;this.on("error",(function(e){var r="Unknown error";e.message&&(r=e.message),e.details&&(r+=" "+e.details),t.setState({error:r})})),this.on("upload-error",(function(e,r,i){var n="Unknown error";if(r.message&&(n=r.message),r.details&&(n+=" "+r.details),t.setFileState(e.id,{error:n,response:i}),t.setState({error:r.message}),"object"==typeof r&&r.message){var o=new Error(r.message);o.details=r.message,r.details&&(o.details+=" "+r.details),o.message=t.i18n("failedToUpload",{file:e.name}),t._showOrLogErrorAndThrow(o,{throwErr:!1})}else t._showOrLogErrorAndThrow(r,{throwErr:!1})})),this.on("upload",(function(){t.setState({error:null})})),this.on("upload-started",(function(e,r){t.getFile(e.id)?t.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("upload-progress",this._calculateProgress),this.on("upload-success",(function(e,r){if(t.getFile(e.id)){var i=t.getFile(e.id).progress;t.setFileState(e.id,{progress:___extends_107({},i,{postprocess:t.postProcessors.length>0?{mode:"indeterminate"}:null,uploadComplete:!0,percentage:100,bytesUploaded:i.bytesTotal}),response:r,uploadURL:r.uploadURL,isPaused:!1}),t._calculateTotalProgress()}else t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("preprocess-progress",(function(e,r){t.getFile(e.id)?t.setFileState(e.id,{progress:___extends_107({},t.getFile(e.id).progress,{preprocess:r})}):t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("preprocess-complete",(function(e){if(t.getFile(e.id)){var r=___extends_107({},t.getState().files);r[e.id]=___extends_107({},r[e.id],{progress:___extends_107({},r[e.id].progress)}),delete r[e.id].progress.preprocess,t.setState({files:r})}else t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("postprocess-progress",(function(e,r){t.getFile(e.id)?t.setFileState(e.id,{progress:___extends_107({},t.getState().files[e.id].progress,{postprocess:r})}):t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("postprocess-complete",(function(e){if(t.getFile(e.id)){var r=___extends_107({},t.getState().files);r[e.id]=___extends_107({},r[e.id],{progress:___extends_107({},r[e.id].progress)}),delete r[e.id].progress.postprocess,t.setState({files:r})}else t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("restored",(function(){t._calculateTotalProgress()})),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",(function(){return t.updateOnlineStatus()})),window.addEventListener("offline",(function(){return t.updateOnlineStatus()})),setTimeout((function(){return t.updateOnlineStatus()}),3e3))},i.updateOnlineStatus=function(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)},i.getID=function(){return this.opts.id},i.use=function(t,e){if("function"!=typeof t)throw new TypeError("Expected a plugin class, but got "+(null===t?"null":typeof t)+". Please verify that the plugin was imported and spelled correctly.");var r=new t(this,e),i=r.id;if(this.plugins[r.type]=this.plugins[r.type]||[],!i)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");var n=this.getPlugin(i);if(n){var o="Already found a plugin named '"+n.id+"'. Tried to use: '"+i+"'.\nUppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.";throw new Error(o)}return t.VERSION&&this.log("Using "+i+" v"+t.VERSION),this.plugins[r.type].push(r),r.install(),this},i.getPlugin=function(t){var e=null;return this.iteratePlugins((function(r){if(r.id===t)return e=r,!1})),e},i.iteratePlugins=function(t){var e=this;Object.keys(this.plugins).forEach((function(r){e.plugins[r].forEach(t)}))},i.removePlugin=function(t){this.log("Removing plugin "+t.id),this.emit("plugin-remove",t),t.uninstall&&t.uninstall();var e=this.plugins[t.type].slice(),r=e.indexOf(t);-1!==r&&(e.splice(r,1),this.plugins[t.type]=e);var i=this.getState();delete i.plugins[t.id],this.setState(i)},i.close=function(){var t=this;this.log("Closing Uppy instance "+this.opts.id+": removing all files and uninstalling plugins"),this.reset(),this._storeUnsubscribe(),this.iteratePlugins((function(e){t.removePlugin(e)}))},i.info=function(t,e,r){void 0===e&&(e="info"),void 0===r&&(r=3e3);var i="object"==typeof t;this.setState({info:{isHidden:!1,type:e,message:i?t.message:t,details:i?t.details:null}}),this.emit("info-visible"),clearTimeout(this.infoTimeoutID),this.infoTimeoutID=0!==r?setTimeout(this.hideInfo,r):void 0},i.hideInfo=function(){var t=___extends_107({},this.getState().info,{isHidden:!0});this.setState({info:t}),this.emit("info-hidden")},i.log=function(t,e){var r=this.opts.logger;switch(e){case"error":r.error(t);break;case"warning":r.warn(t);break;default:r.debug(t)}},i.run=function(){return this.log("Calling run() is no longer necessary.","warning"),this},i.restore=function(t){return this.log('Core: attempting to restore upload "'+t+'"'),this.getState().currentUploads[t]?this._runUpload(t):(this._removeUpload(t),Promise.reject(new Error("Nonexistent upload")))},i._createUpload=function(t,e){var r;void 0===e&&(e={});var i=e.forceAllowNewUpload,n=void 0!==i&&i,o=this.getState(),a=o.allowNewUpload,s=o.currentUploads;if(!a&&!n)throw new Error("Cannot create a new upload: already uploading.");var u=_$cuid_262();return this.emit("upload",{id:u,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploads,currentUploads:___extends_107({},s,(r={},r[u]={fileIDs:t,step:0,result:{}},r))}),u},i._getUpload=function(t){return this.getState().currentUploads[t]},i.addResultData=function(t,e){var r;if(this._getUpload(t)){var i=this.getState().currentUploads,n=___extends_107({},i[t],{result:___extends_107({},i[t].result,e)});this.setState({currentUploads:___extends_107({},i,(r={},r[t]=n,r))})}else this.log("Not setting result for an upload that has been removed: "+t)},i._removeUpload=function(t){var e=___extends_107({},this.getState().currentUploads);delete e[t],this.setState({currentUploads:e})},i._runUpload=function(t){var e=this,r=this.getState().currentUploads[t].step,i=[].concat(this.preProcessors,this.uploaders,this.postProcessors),n=Promise.resolve();return i.forEach((function(i,o){o>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return o(240|e>>>18&7)+o(128|e>>>12&63)+o(128|e>>>6&63)+o(128|63&e)},s=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(t){return t.replace(s,a)},h=function(t){var e=[0,2,1][t.length%3],r=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[i.charAt(r>>>18),i.charAt(r>>>12&63),e>=2?"=":i.charAt(r>>>6&63),e>=1?"=":i.charAt(63&r)].join("")},f=t.btoa&&"function"==typeof t.btoa?function(e){return t.btoa(e)}:function(t){if(t.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return t.replace(/[\s\S]{1,3}/g,h)},c=function(t){return f(u(String(t)))},l=function(t){return t.replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"})).replace(/=/g,"")},_=function(t,e){return e?l(c(t)):c(t)};t.Uint8Array&&(e=function(t,e){for(var r="",n=0,o=t.length;n>>18)+i.charAt(h>>>12&63)+(void 0!==s?i.charAt(h>>>6&63):"=")+(void 0!==u?i.charAt(63&h):"=")}return e?l(r):r});var d,p=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,m=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return o(55296+(e>>>10))+o(56320+(1023&e));case 3:return o((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return o((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},b=function(t){return t.replace(p,m)},g=function(t){var e=t.length,r=e%4,i=(e>0?n[t.charAt(0)]<<18:0)|(e>1?n[t.charAt(1)]<<12:0)|(e>2?n[t.charAt(2)]<<6:0)|(e>3?n[t.charAt(3)]:0),a=[o(i>>>16),o(i>>>8&255),o(255&i)];return a.length-=[0,0,2,1][r],a.join("")},v=t.atob&&"function"==typeof t.atob?function(e){return t.atob(e)}:function(t){return t.replace(/\S{1,4}/g,g)},y=function(t){return v(String(t).replace(/[^A-Za-z0-9\+\/]/g,""))},w=function(t){return String(t).replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},M=function(t){return function(t){return b(v(t))}(w(t))};if(t.Uint8Array&&(d=function(t){return Uint8Array.from(y(w(t)),(function(t){return t.charCodeAt(0)}))}),t.Base64={VERSION:"2.6.4",atob:y,btoa:f,fromBase64:M,toBase64:_,utob:u,encode:_,encodeURI:function(t){return _(t,!0)},btou:b,decode:M,noConflict:function(){var e=t.Base64;return t.Base64=r,e},fromUint8Array:e,toUint8Array:d},"function"==typeof Object.defineProperty){var S=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}};t.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",S((function(){return M(this)}))),Object.defineProperty(String.prototype,"toBase64",S((function(t){return _(this,t)}))),Object.defineProperty(String.prototype,"toBase64URI",S((function(){return _(this,!0)})))}}return t.Meteor&&(Base64=t.Base64),_$base64_318.exports?_$base64_318.exports.Base64=t.Base64:"function"==typeof define&&define.amd&&define([],(function(){return t.Base64})),{Base64:t.Base64}}))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$base64_318=_$base64_318.exports;var _$requiresPort_343=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},_$querystringify_340={},undef,__has_340=Object.prototype.hasOwnProperty;function decode(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return null}}function __encode_340(t){try{return encodeURIComponent(t)}catch(e){return null}}_$querystringify_340.stringify=function(t,e){e=e||"";var r,i,n=[];for(i in"string"!=typeof e&&(e="?"),t)if(__has_340.call(t,i)){if((r=t[i])||null!==r&&r!==undef&&!isNaN(r)||(r=""),i=__encode_340(i),r=__encode_340(r),null===i||null===r)continue;n.push(i+"="+r)}return n.length?e+n.join("&"):""},_$querystringify_340.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,i={};e=r.exec(t);){var n=decode(e[1]),o=decode(e[2]);null===n||null===o||n in i||(i[n]=o)}return i};var _$urlParse_390={};(function(t){"use strict";var e=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,r=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,i=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function n(t){return(t||"").toString().replace(i,"")}var o=[["#","hash"],["?","query"],function(t){return t.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],a={hash:1,query:1};function s(r){var i,n=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(r=r||n);if("blob:"===r.protocol)o=new h(unescape(r.pathname),{});else if("string"===s)for(i in o=new h(r,{}),a)delete o[i];else if("object"===s){for(i in r)i in a||(o[i]=r[i]);void 0===o.slashes&&(o.slashes=e.test(r.href))}return o}function u(t){t=n(t);var e=r.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!(e[2]&&e[2].length>=2),rest:e[2]&&1===e[2].length?"/"+e[3]:e[3]}}function h(t,e,r){if(t=n(t),!(this instanceof h))return new h(t,e,r);var i,a,f,c,l,_,d=o.slice(),p=typeof e,m=this,b=0;for("object"!==p&&"string"!==p&&(r=e,e=null),r&&"function"!=typeof r&&(r=_$querystringify_340.parse),e=s(e),i=!(a=u(t||"")).protocol&&!a.slashes,m.slashes=a.slashes||i&&e.slashes,m.protocol=a.protocol||e.protocol||"",t=a.rest,a.slashes||(d[3]=[/(.*)/,"pathname"]);b1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(i=e.call(this,t)).originalRequest=o,i.originalResponse=a,i.causingError=n,null!=n&&(t+=", caused by ".concat(n.toString())),null!=o){var s=o.getHeader("X-Request-ID")||"n/a",u=o.getMethod(),h=o.getURL(),f=a?a.getStatus():"n/a",c=a?a.getBody()||"":"n/a";t+=", originated from request (method: ".concat(u,", url: ").concat(h,", response code: ").concat(f,", response text: ").concat(c,", request id: ").concat(s,")")}return i.message=t,i}return r}();_$error_381.default=___default_381;var _$logger_382={};Object.defineProperty(_$logger_382,"__esModule",{value:!0}),_$logger_382.enableDebugLog=function(){isEnabled=!0},_$logger_382.log=function(t){isEnabled&&console.log(t)};var isEnabled=!1,_$uuid_385={};Object.defineProperty(_$uuid_385,"__esModule",{value:!0}),_$uuid_385.default=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))};var _$upload_384={};Object.defineProperty(_$upload_384,"__esModule",{value:!0}),_$upload_384.default=void 0;var _urlParse=_interopRequireDefault(_$urlParse_390),_error=_interopRequireDefault(_$error_381),_uuid=_interopRequireDefault(_$uuid_385);function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function __ownKeys_384(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if("function"==typeof r||"function"==typeof i)throw new Error("tus: the terminate function does not accept a callback since v2 anymore; please use the returned Promise instead");var n=openRequest("DELETE",e,r);return sendRequest(n,null,r).then((function(t){if(204!==t.getStatus())throw new _error.default("tus: unexpected response while terminating upload",null,n,t)})).catch((function(i){if(i instanceof _error.default||(i=new _error.default("tus: failed to terminate upload",i,n,null)),!shouldRetry(i,0,r))throw i;var o=r.retryDelays[0],a=r.retryDelays.slice(1),s=_objectSpread({},r,{retryDelays:a});return new Promise((function(t){return setTimeout(t,o)})).then((function(){return t.terminate(e,s)}))}))}}],(r=[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then((function(e){return t._urlStorage.findUploadsByFingerprint(e)}))}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,e=this.file;if(e)if(this.options.endpoint||this.options.uploadUrl){var r=this.options.retryDelays;null==r||"[object Array]"===Object.prototype.toString.call(r)?(this.options.parallelUploads>1&&["uploadUrl","uploadSize","uploadLengthDeferred"].forEach((function(e){t.options[e]&&t._emitError(new Error("tus: cannot use the ".concat(e," option when parallelUploads is enabled")))})),this.options.fingerprint(e,this.options).then((function(r){return null==r?(0,_$logger_382.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,_$logger_382.log)("Calculated fingerprint: ".concat(r)),t._fingerprint=r,t._source?t._source:t.options.fileReader.openFile(e,t.options.chunkSize)})).then((function(e){t._source=e,t.options.parallelUploads>1||null!=t._parallelUploadUrls?t._startParallelUpload():t._startSingleUpload()})).catch((function(e){t._emitError(e)}))):this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var e=this,r=this._size=this._source.size,i=0;this._parallelUploads=[];var n=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,o=function(t,e,r){for(var i=Math.floor(t/e),n=[],o=0;othis._offsetBeforeRetry&&(this._retryAttempt=0),shouldRetry(t,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){e.start()}),r))}if("function"!=typeof this.options.onError)throw t;this.options.onError(t)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,e){"function"==typeof this.options.onProgress&&this.options.onProgress(t,e)}},{key:"_emitChunkComplete",value:function(t,e,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(t,e,r)}},{key:"_createUpload",value:function(){var t=this;if(this.options.endpoint){var e=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?e.setHeader("Upload-Defer-Length",1):e.setHeader("Upload-Length",this._size);var r,i=encodeMetadata(this.options.metadata);""!==i&&e.setHeader("Upload-Metadata",i),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(e)):r=this._sendRequest(e,null),r.then((function(r){if(inStatusCategory(r.getStatus(),200)){var i=r.getHeader("Location");if(null!=i){if(t.url=resolveUrl(t.options.endpoint,i),(0,_$logger_382.log)("Created upload at ".concat(t.url)),"function"==typeof t.options._onUploadUrlAvailable&&t.options._onUploadUrlAvailable(),0===t._size)return t._emitSuccess(),void t._source.close();t._saveUploadInUrlStorage(),t.options.uploadDataDuringCreation?t._handleUploadResponse(e,r):(t._offset=0,t._performUpload())}else t._emitHttpError(e,r,"tus: invalid or missing Location header")}else t._emitHttpError(e,r,"tus: unexpected response while creating upload")})).catch((function(r){t._emitHttpError(e,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var t=this,e=this._openRequest("HEAD",this.url);this._sendRequest(e,null).then((function(r){var i=r.getStatus();if(!inStatusCategory(i,200))return inStatusCategory(i,400)&&t._removeFromUrlStorage(),423===i?void t._emitHttpError(e,r,"tus: upload is currently locked; retry later"):t.options.endpoint?(t.url=null,void t._createUpload()):void t._emitHttpError(e,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)");var n=parseInt(r.getHeader("Upload-Offset"),10);if(isNaN(n))t._emitHttpError(e,r,"tus: invalid or missing offset value");else{var o=parseInt(r.getHeader("Upload-Length"),10);if(!isNaN(o)||t.options.uploadLengthDeferred){if("function"==typeof t.options._onUploadUrlAvailable&&t.options._onUploadUrlAvailable(),n===o)return t._emitProgress(o,o),void t._emitSuccess();t._offset=n,t._performUpload()}else t._emitHttpError(e,r,"tus: invalid or missing length value")}})).catch((function(r){t._emitHttpError(e,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var t,e=this;this._aborted||(this.options.overridePatchMethod?(t=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):t=this._openRequest("PATCH",this.url),t.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(t).then((function(r){inStatusCategory(r.getStatus(),200)?e._handleUploadResponse(t,r):e._emitHttpError(t,r,"tus: unexpected response while uploading chunk")})).catch((function(r){e._aborted||e._emitHttpError(t,null,"tus: failed to upload chunk at offset "+e._offset,r)})))}},{key:"_addChunkToRequest",value:function(t){var e=this,r=this._offset,i=this._offset+this.options.chunkSize;return t.setProgressHandler((function(t){e._emitProgress(r+t,e._size)})),t.setHeader("Content-Type","application/offset+octet-stream"),(i===1/0||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(r,i).then((function(r){var i=r.value,n=r.done;return e.options.uploadLengthDeferred&&n&&(e._size=e._offset+(i&&i.size?i.size:0),t.setHeader("Upload-Length",e._size)),null===i?e._sendRequest(t):(e._emitProgress(e._offset,e._size),e._sendRequest(t,i))}))}},{key:"_handleUploadResponse",value:function(t,e){var r=parseInt(e.getHeader("Upload-Offset"),10);if(isNaN(r))this._emitHttpError(t,e,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r==this._size)return this._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(t,e){var r=openRequest(t,e,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(e){t._emitError(e)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(this.options.storeFingerprintForResuming&&this._fingerprint){var e={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};this._parallelUploads?e.parallelUploadUrls=this._parallelUploadUrls:e.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,e).then((function(e){return t._urlStorageKey=e})).catch((function(e){t._emitError(e)}))}}},{key:"_sendRequest",value:function(t){return sendRequest(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,this.options)}}])&&___defineProperties_384(e.prototype,r),i&&___defineProperties_384(e,i),t}();function encodeMetadata(t){var e=[];for(var r in t)e.push(r+" "+_$base64_318.Base64.encode(t[r]));return e.join(",")}function inStatusCategory(t,e){return t>=e&&t=r.retryDelays.length||null==t.originalRequest)return!1;if(r&&"function"==typeof r.onShouldRetry)return r.onShouldRetry(t,e,r);var i,n=t.originalResponse?t.originalResponse.getStatus():0;return(!inStatusCategory(n,400)||409===n||423===n)&&(i=!0,"undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(i=!1),i)}function resolveUrl(t,e){return new _urlParse.default(e,t).toString()}BaseUpload.defaultOptions=defaultOptions;var ___default_384=BaseUpload;_$upload_384.default=___default_384;var _$noopUrlStorage_383={};function ___defineProperties_383(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,i){t._xhr.onload=function(){r(new Response(t._xhr))},t._xhr.onerror=function(t){i(t)},t._xhr.send(e)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),t}(),Response=function(){function t(e){_classCallCheck(this,t),this._xhr=e}return _createClass(t,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),t}(),_$isReactNative_377={};Object.defineProperty(_$isReactNative_377,"__esModule",{value:!0}),_$isReactNative_377.default=void 0;var ___default_377=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};_$isReactNative_377.default=___default_377;var _$uriToBlob_379={};Object.defineProperty(_$uriToBlob_379,"__esModule",{value:!0}),_$uriToBlob_379.default=function(t){return new Promise((function(e,r){var i=new XMLHttpRequest;i.responseType="blob",i.onload=function(){var t=i.response;e(t)},i.onerror=function(t){r(t)},i.open("GET",t),i.send()}))};var _$isCordova_376={};Object.defineProperty(_$isCordova_376,"__esModule",{value:!0}),_$isCordova_376.default=void 0;var ___default_376=function(){return"undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)};_$isCordova_376.default=___default_376;var _$readAsByteArray_378={};Object.defineProperty(_$readAsByteArray_378,"__esModule",{value:!0}),_$readAsByteArray_378.default=function(t){return new Promise((function(e,r){var i=new FileReader;i.onload=function(){var t=new Uint8Array(i.result);e({value:t})},i.onerror=function(t){r(t)},i.readAsArrayBuffer(t)}))};var _$fileReader_372={};Object.defineProperty(_$fileReader_372,"__esModule",{value:!0}),_$fileReader_372.default=void 0;var _isReactNative=___interopRequireDefault_372(_$isReactNative_377),_uriToBlob=___interopRequireDefault_372(_$uriToBlob_379),_isCordova=___interopRequireDefault_372(_$isCordova_376),_readAsByteArray=___interopRequireDefault_372(_$readAsByteArray_378);function ___interopRequireDefault_372(t){return t&&t.__esModule?t:{default:t}}function ___classCallCheck_372(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ___defineProperties_372(t,e){for(var r=0;rthis._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var r=0===__len_372(this._buffer);return this._done&&r?null:this._buffer.slice(0,e-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),t}();function __len_372(t){return void 0===t?0:void 0!==t.size?t.size:t.length}var __FileReader_372=function(){function t(){___classCallCheck_372(this,t)}return ___createClass_372(t,[{key:"openFile",value:function(t,e){return(0,_isReactNative.default)()&&t&&void 0!==t.uri?(0,_uriToBlob.default)(t.uri).then((function(t){return new FileSource(t)})).catch((function(t){throw new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. "+t)})):"function"==typeof t.slice&&void 0!==t.size?Promise.resolve(new FileSource(t)):"function"==typeof t.read?(e=+e,isFinite(e)?Promise.resolve(new StreamSource(t,e)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment"))}}]),t}();_$fileReader_372.default=__FileReader_372;var _$fingerprint_373={};Object.defineProperty(_$fingerprint_373,"__esModule",{value:!0}),_$fingerprint_373.default=function(t,e){return(0,___isReactNative_373.default)()?Promise.resolve(function(t,e){var r=t.exif?function(t){var e=0;if(0===t.length)return e;for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=___objectSpread_375({},__defaultOptions_375,{},e),i.call(this,t,e)}return e=n,r=[{key:"terminate",value:function(t,e,r){return e=___objectSpread_375({},__defaultOptions_375,{},e),_upload.default.terminate(t,e,r)}}],null&&___defineProperties_375(e.prototype,null),r&&___defineProperties_375(e,r),n}();_$browser_375.Upload=Upload;var _window=window,__XMLHttpRequest_375=_window.XMLHttpRequest,__Blob_375=_window.Blob,isSupported=__XMLHttpRequest_375&&__Blob_375&&"function"==typeof __Blob_375.prototype.slice;function ___wrapNativeSuper_99(t){var e="function"==typeof Map?new Map:void 0;return(___wrapNativeSuper_99=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return ___construct_99(t,arguments,___getPrototypeOf_99(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),___setPrototypeOf_99(i,t)})(t)}function ___construct_99(t,r,i){return(___construct_99=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&___setPrototypeOf_99(n,r.prototype),n}).apply(null,arguments)}function ___setPrototypeOf_99(t,e){return(___setPrototypeOf_99=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ___getPrototypeOf_99(t){return(___getPrototypeOf_99=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var AuthError=function(t){var e,r;function i(){var e;return(e=t.call(this,"Authorization required")||this).name="AuthError",e.isAuthError=!0,e}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(___wrapNativeSuper_99(Error)),_$AuthError_99=AuthError;function ___wrapNativeSuper_114(t){var e="function"==typeof Map?new Map:void 0;return(___wrapNativeSuper_114=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return ___construct_114(t,arguments,___getPrototypeOf_114(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),___setPrototypeOf_114(i,t)})(t)}function ___construct_114(t,r,i){return(___construct_114=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&___setPrototypeOf_114(n,r.prototype),n}).apply(null,arguments)}function ___setPrototypeOf_114(t,e){return(___setPrototypeOf_114=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ___getPrototypeOf_114(t){return(___getPrototypeOf_114=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var NetworkError=function(t){var e,r;function i(e,r){var i;return void 0===r&&(r=null),(i=t.call(this,"This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.\n\nSource error: ["+e+"]")||this).isNetworkError=!0,i.request=r,i}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(___wrapNativeSuper_114(Error)),_$NetworkError_114=NetworkError,_$fetchWithNetworkError_118=function(){return fetch.apply(void 0,arguments).catch((function(t){throw"AbortError"===t.name?t:new _$NetworkError_114(t)}))},_class,_temp;function ___extends_101(){return(___extends_101=Object.assign||function(t){for(var e=1;e300){var e="Failed request with status: "+t.status+". "+t.statusText;return t.json().then((function(t){throw e=t.message?e+" message: "+t.message:e,e=t.requestId?e+" request-Id: "+t.requestId:e,new Error(e)})).catch((function(){throw new Error(e)}))}return t.json()},i.preflight=function(t){var e=this;return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(this._getUrl(t),{method:"OPTIONS"}).then((function(t){return t.headers.has("access-control-allow-headers")&&(e.allowedHeaders=t.headers.get("access-control-allow-headers").split(",").map((function(t){return t.trim().toLowerCase()}))),e.preflightDone=!0,e.allowedHeaders.slice()})).catch((function(t){return e.uppy.log("[CompanionClient] unable to make preflight request "+t,"warning"),e.preflightDone=!0,e.allowedHeaders.slice()}))},i.preflightAndHeaders=function(t){var e=this;return Promise.all([this.preflight(t),this.headers()]).then((function(t){var r=t[0],i=t[1];return Object.keys(i).forEach((function(t){-1===r.indexOf(t.toLowerCase())&&(e.uppy.log("[CompanionClient] excluding unallowed header "+t),delete i[t])})),i}))},i.get=function(t,e){var r=this;return this.preflightAndHeaders(t).then((function(e){return _$fetchWithNetworkError_118(r._getUrl(t),{method:"get",headers:e,credentials:r.opts.companionCookiesRule||"same-origin"})})).then(this._getPostResponseFunc(e)).then((function(t){return r._json(t)})).catch((function(e){return e=e.isAuthError?e:new Error("Could not get "+r._getUrl(t)+". "+e),Promise.reject(e)}))},i.post=function(t,e,r){var i=this;return this.preflightAndHeaders(t).then((function(r){return _$fetchWithNetworkError_118(i._getUrl(t),{method:"post",headers:r,credentials:i.opts.companionCookiesRule||"same-origin",body:JSON.stringify(e)})})).then(this._getPostResponseFunc(r)).then((function(t){return i._json(t)})).catch((function(e){return e=e.isAuthError?e:new Error("Could not post "+i._getUrl(t)+". "+e),Promise.reject(e)}))},i.delete=function(t,e,r){var i=this;return this.preflightAndHeaders(t).then((function(r){return _$fetchWithNetworkError_118(i.hostname+"/"+t,{method:"delete",headers:r,credentials:i.opts.companionCookiesRule||"same-origin",body:e?JSON.stringify(e):null})})).then(this._getPostResponseFunc(r)).then((function(t){return i._json(t)})).catch((function(e){return e=e.isAuthError?e:new Error("Could not delete "+i._getUrl(t)+". "+e),Promise.reject(e)}))},e=t,(r=[{key:"hostname",get:function(){var t=this.uppy.getState().companion,e=this.opts.companionUrl;return(t&&t[e]?t[e]:e).replace(/\/$/,"")}},{key:"defaultHeaders",get:function(){return{Accept:"application/json","Content-Type":"application/json","Uppy-Versions":"@uppy/companion-client="+t.VERSION}}}])&&___defineProperties_101(e.prototype,r),t}(),_class.VERSION="1.8.2",_temp),__has_334=Object.prototype.hasOwnProperty,_$queryStringify_334=function t(e,r){var i=[];for(var n in e)if(__has_334.call(e,n)){var o,a=e[n],s=encodeURIComponent(n);o="object"==typeof a?t(a,r?r+"["+s+"]":s):(r?r+"["+s+"]":s)+"="+encodeURIComponent(a),i.push(o)}return i.join("&")},_$tokenStorage_105={};function ___extends_100(){return(___extends_100=Object.assign||function(t){for(var e=1;e0&&t.isOpen;){var r=t._queued[0];t.send(r.action,r.payload),t._queued=t._queued.slice(1)}},this.socket.onclose=function(e){t.isOpen=!1},this.socket.onmessage=this._handleMessage},e.close=function(){this.socket&&this.socket.close()},e.send=function(t,e){this.isOpen?this.socket.send(JSON.stringify({action:t,payload:e})):this._queued.push({action:t,payload:e})},e.on=function(t,e){this.emitter.on(t,e)},e.emit=function(t,e){this.emitter.emit(t,e)},e.once=function(t,e){this.emitter.once(t,e)},e._handleMessage=function(t){try{var e=JSON.parse(t.data);this.emit(e.action,e.payload)}catch(err){console.log(err)}},t}(),_$lib_104={RequestClient:_$RequestClient_101,Provider:_$Provider_100,Socket:_$Socket_103},_$emitSocketProgress_117=_$lodashThrottle_320((function(t,e,r){var i=e.progress,n=e.bytesUploaded,o=e.bytesTotal;i&&(t.uppy.log("Upload progress: "+i),t.uppy.emit("upload-progress",r,{uploader:t,bytesUploaded:n,bytesTotal:o}))}),300,{leading:!0,trailing:!0}),_$getSocketHost_123=function(t){var e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(t)[1];return(/^http:\/\//i.test(t)?"ws":"wss")+"://"+e},_$settle_129=function(t){var e=[],r=[];function i(t){e.push(t)}function n(t){r.push(t)}return Promise.all(t.map((function(t){return t.then(i,n)}))).then((function(){return{successful:e,failed:r}}))},_$EventTracker_113=function(){function t(t){this._events=[],this._emitter=t}var e=t.prototype;return e.on=function(t,e){return this._events.push([t,e]),this._emitter.on(t,e)},e.remove=function(){var t=this;this._events.forEach((function(e){var r=e[0],i=e[1];t._emitter.off(r,i)}))},t}(),_$isNetworkError_127=function(t){return!!t&&(0!==t.readyState&&4!==t.readyState||0===t.status)},_$RateLimitedQueue_115=function(){function t(t){this.limit="number"!=typeof t||0===t?1/0:t,this.activeRequests=0,this.queuedHandlers=[]}var e=t.prototype;return e._call=function(t){var e=this;this.activeRequests+=1;var r,i=!1;try{r=t()}catch(err){throw this.activeRequests-=1,err}return{abort:function(){i||(i=!0,e.activeRequests-=1,r(),e._queueNext())},done:function(){i||(i=!0,e.activeRequests-=1,e._queueNext())}}},e._queueNext=function(){var t=this;Promise.resolve().then((function(){t._next()}))},e._next=function(){if(!(this.activeRequests>=this.limit)&&0!==this.queuedHandlers.length){var t=this.queuedHandlers.shift(),e=this._call(t.fn);t.abort=e.abort,t.done=e.done}},e._queue=function(t,e){var r=this;void 0===e&&(e={});var i={fn:t,priority:e.priority||0,abort:function(){r._dequeue(i)},done:function(){throw new Error("Cannot mark a queued request as done: this indicates a bug")}},n=function(t,e){for(var r=0;rn.priority)return r;var n;return-1}(this.queuedHandlers);return-1===n?this.queuedHandlers.push(i):this.queuedHandlers.splice(n,0,i),i},e._dequeue=function(t){var e=this.queuedHandlers.indexOf(t);-1!==e&&this.queuedHandlers.splice(e,1)},e.run=function(t,e){return this.activeRequestst.height>0),"DESCENDING"===e?t.sort((t,e)=>e.height-t.height):t.sort((t,e)=>t.height-e.height)}catch(err){throw console.log("Error in util.js/sortConfTxs()"),err}}async sortAllTxs(t,e="DESCENDING"){try{const r=await this.blockchain.getBlockCount()+1,i=t.map(t=>(t.height<=0&&(t.height=r),t));return this.sortConfTxs(i,e)}catch(err){throw console.log("Error in util.js/sort0ConfTxs"),err}}},_$utxo_32=class{constructor(t){this.electrumx=new _$electrumx_12(t),this.slp=new _$slp_27(t)}async get(t,e=!1){try{if("string"==typeof t&&(t=[t]),t.length>20)throw new Error("Too many elements, 20 max.");const r=t.map(t=>this.slp.Address.toCashAddress(t)),i=await this.electrumx.utxo(r);let n;n=e?await this.slp.Utils.hydrateUtxosWL(i.utxos):await this.slp.Utils.hydrateUtxos(i.utxos);const o=[];for(let t=0;t!1===t.isValid),r.nullUtxos=e.utxos.filter(t=>null===t.isValid),r.slpUtxos={type1:{},nft:{}},r.slpUtxos.type1.mintBatons=e.utxos.filter(t=>{const e=!0===t.isValid,r=1===t.tokenType,i="minting-baton"===t.utxoType;return e&&r&&i}),r.slpUtxos.type1.tokens=e.utxos.filter(t=>{const e=!0===t.isValid,r=1===t.tokenType,i="token"===t.utxoType;return e&&r&&i}),r.slpUtxos.nft.groupMintBatons=e.utxos.filter(t=>{const e=!0===t.isValid,r=129===t.tokenType,i="minting-baton"===t.utxoType;return e&&r&&i}),r.slpUtxos.nft.groupTokens=e.utxos.filter(t=>{const e=!0===t.isValid,r=129===t.tokenType,i="token"===t.utxoType;return e&&r&&i}),r.slpUtxos.nft.tokens=e.utxos.filter(t=>{const e=!0===t.isValid,r=65===t.tokenType,i="token"===t.utxoType;return e&&r&&i}),o.push(r)}return o}catch(err){throw console.error("Error in bchjs.utxo.get()"),err}}findBiggestUtxo(t){let e=0,r=0;if(!Array.isArray(t))throw new Error("utxos input to findBiggestUtxo() must be an array");for(let i=0;ie&&(e=n.satoshis,r=i)}return t[r]}};let ___this_19;var _$ninsight_19=class{constructor(t){t&&(this.ninsightURL=t.ninsightURL?t.ninsightURL:"https://rest.bitcoin.com/v2"),this.axiosOptions={headers:{authorization:"Token "+this.apiToken,timeout:15e3}},___this_19=this}async utxo(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/address/utxo",{addresses:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/address/utxo",{addresses:t},___this_19.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async unconfirmed(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/address/unconfirmed",{addresses:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/address/unconfirmed",{addresses:t},___this_19.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async transactions(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/address/transactions",{addresses:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/address/transactions",{addresses:t},___this_19.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async txDetails(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/transaction/details",{txids:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/transaction/details",{txids:t},___this_19.axiosOptions)).data;throw new Error("Transaction ID must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}},_$bchJs_6={};(function(t,e){_$bchJs_6=class{constructor(r){if(r&&r.restURL&&""!==r.restURL?this.restURL=r.restURL:t.env.RESTURL&&""!==t.env.RESTURL?this.restURL=t.env.RESTURL:this.restURL="https://api.fullstack.cash/v4/",this.apiToken="",r&&r.apiToken&&""!==r.apiToken?this.apiToken=r.apiToken:this.apiToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlODhhY2JmMDIyMWMxMDAxMmFkOTNmZiIsImVtYWlsIjoiY2hyaXMudHJvdXRuZXJAZ21haWwuY29tIiwiYXBpTGV2ZWwiOjQwLCJyYXRlTGltaXQiOjMsImlhdCI6MTYxMzcwMjYxOSwiZXhwIjoxNjE2Mjk0NjE5fQ.zW7_aZjG6MjD4aOCu2IOZAn_8Rj1FalxwTtPV46CLxo",this.authPass="",r&&r.authPass&&""!==r.authPass?this.authPass=r.authPass:t.env.BCHJSAUTHPASS&&""!==t.env.BCHJSAUTHPASS&&(this.authPass=t.env.BCHJSAUTHPASS),this.authToken="",this.authPass){const t="fullstackcash:"+this.authPass,r=e.from(t).toString("base64");this.authToken="Basic "+r}const i={restURL:this.restURL,apiToken:this.apiToken,authToken:this.authToken};this.Ninsight=new _$ninsight_19(r),this.Electrumx=new _$electrumx_12(i),this.Control=new _$control_9(i),this.Mining=new _$mining_17(i),this.RawTransactions=new _$rawTransactions_21(i),this.Address=new _$address_5(i),this.BitcoinCash=new _$bitcoincash_7(this.Address),this.Blockchain=new _$blockchain_8(i),this.Crypto=_$crypto_10,this.ECPair=_$ECPair_11,this.ECPair.setAddress(this.Address),this.encryption=new _$encryption_13(i),this.Generating=new _$generating_14(i),this.HDNode=new _$hdnode_15(this.Address),this.Mnemonic=new _$mnemonic_18(this.Address),this.Price=new _$price_20(i),this.Script=new _$script_23,this.TransactionBuilder=_$TransactionBuilder_30,this.TransactionBuilder.setAddress(this.Address),this.Util=new _$util_31(i),this.Schnorr=new _$schnorr_22(i),this.SLP=new _$slp_27(i),this.SLP.HDNode=this.HDNode,this.IPFS=new _$ipfs_16,this.Utxo=new _$utxo_32(i)}}}).call(this,_$browser_550,_$buffer_460({}).Buffer);var _$core_230={};(function(t){var r;r=function(){var r=r||function(r,i){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==t&&t.crypto&&(n=t.crypto),!n)try{n=_$cryptoBrowserify_469({})}catch(err){}var o=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(err){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(err){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),s={},u=s.lib={},h=u.Base={extend:function(t){var e=a(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=u.WordArray=h.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o>>2]>>>24-o%4*8&255;e[i+o>>>2]|=a<<24-(i+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=r.ceil(e/4)},clone:function(){var t=h.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new f.init(r,e/2)}},_=c.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new f.init(r,e)}},d=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(_.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return _.parse(unescape(encodeURIComponent(t)))}},p=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e,i=this._data,n=i.words,o=i.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=t?r.ceil(s):r.max((0|s)-this._minBufferSize,0))*a,h=r.min(4*u,o);if(u){for(var c=0;c>>2]|=t[n]<<24-n%4*8;r.call(this,i,e)}else r.apply(this,arguments)}).prototype=e}}(),t.lib.WordArray},"object"==typeof _$libTypedarrays_237?_$libTypedarrays_237=_$libTypedarrays_237=__factory_237(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_237):__factory_237(__root_237.CryptoJS);var _$encUtf16_232={},__root_232,__factory_232;__root_232=this,__factory_232=function(t){return function(){var e=t,r=e.lib.WordArray,i=e.enc;function n(t){return t<<8&4278255360|t>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>1]|=t.charCodeAt(n)<<16-n%2*16;return r.create(i,2*e)}},i.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],o=0;o>>2]>>>16-o%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(t){for(var e=t.length,i=[],o=0;o>>1]|=n(t.charCodeAt(o)<<16-o%2*16);return r.create(i,2*e)}}}(),t.enc.Utf16},"object"==typeof _$encUtf16_232?_$encUtf16_232=_$encUtf16_232=__factory_232(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_232):__factory_232(__root_232.CryptoJS);var _$encBase64_231={},__root_231,__factory_231;__root_231=this,__factory_231=function(t){return r=(e=t).lib.WordArray,e.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,i=this._map;t.clamp();for(var n=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var u=i.charAt(64);if(u)for(;n.length%4;)n.push(u);return n.join("")},parse:function(t){var e=t.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return r.create(n,o)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},t.enc.Base64;var e,r},"object"==typeof _$encBase64_231?_$encBase64_231=_$encBase64_231=__factory_231(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_231):__factory_231(__root_231.CryptoJS);var _$md5_238={},__root_238,__factory_238;__root_238=this,__factory_238=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=e+r,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=t[e+0],u=t[e+1],_=t[e+2],d=t[e+3],p=t[e+4],m=t[e+5],b=t[e+6],g=t[e+7],v=t[e+8],y=t[e+9],w=t[e+10],M=t[e+11],S=t[e+12],$=t[e+13],E=t[e+14],k=t[e+15],A=o[0],B=o[1],x=o[2],T=o[3];A=h(A,B,x,T,a,7,s[0]),T=h(T,A,B,x,u,12,s[1]),x=h(x,T,A,B,_,17,s[2]),B=h(B,x,T,A,d,22,s[3]),A=h(A,B,x,T,p,7,s[4]),T=h(T,A,B,x,m,12,s[5]),x=h(x,T,A,B,b,17,s[6]),B=h(B,x,T,A,g,22,s[7]),A=h(A,B,x,T,v,7,s[8]),T=h(T,A,B,x,y,12,s[9]),x=h(x,T,A,B,w,17,s[10]),B=h(B,x,T,A,M,22,s[11]),A=h(A,B,x,T,S,7,s[12]),T=h(T,A,B,x,$,12,s[13]),x=h(x,T,A,B,E,17,s[14]),A=f(A,B=h(B,x,T,A,k,22,s[15]),x,T,u,5,s[16]),T=f(T,A,B,x,b,9,s[17]),x=f(x,T,A,B,M,14,s[18]),B=f(B,x,T,A,a,20,s[19]),A=f(A,B,x,T,m,5,s[20]),T=f(T,A,B,x,w,9,s[21]),x=f(x,T,A,B,k,14,s[22]),B=f(B,x,T,A,p,20,s[23]),A=f(A,B,x,T,y,5,s[24]),T=f(T,A,B,x,E,9,s[25]),x=f(x,T,A,B,d,14,s[26]),B=f(B,x,T,A,v,20,s[27]),A=f(A,B,x,T,$,5,s[28]),T=f(T,A,B,x,_,9,s[29]),x=f(x,T,A,B,g,14,s[30]),A=c(A,B=f(B,x,T,A,S,20,s[31]),x,T,m,4,s[32]),T=c(T,A,B,x,v,11,s[33]),x=c(x,T,A,B,M,16,s[34]),B=c(B,x,T,A,E,23,s[35]),A=c(A,B,x,T,u,4,s[36]),T=c(T,A,B,x,p,11,s[37]),x=c(x,T,A,B,g,16,s[38]),B=c(B,x,T,A,w,23,s[39]),A=c(A,B,x,T,$,4,s[40]),T=c(T,A,B,x,a,11,s[41]),x=c(x,T,A,B,d,16,s[42]),B=c(B,x,T,A,b,23,s[43]),A=c(A,B,x,T,y,4,s[44]),T=c(T,A,B,x,S,11,s[45]),x=c(x,T,A,B,k,16,s[46]),A=l(A,B=c(B,x,T,A,_,23,s[47]),x,T,a,6,s[48]),T=l(T,A,B,x,g,10,s[49]),x=l(x,T,A,B,E,15,s[50]),B=l(B,x,T,A,m,21,s[51]),A=l(A,B,x,T,S,6,s[52]),T=l(T,A,B,x,d,10,s[53]),x=l(x,T,A,B,w,15,s[54]),B=l(B,x,T,A,u,21,s[55]),A=l(A,B,x,T,v,6,s[56]),T=l(T,A,B,x,k,10,s[57]),x=l(x,T,A,B,b,15,s[58]),B=l(B,x,T,A,$,21,s[59]),A=l(A,B,x,T,p,6,s[60]),T=l(T,A,B,x,M,10,s[61]),x=l(x,T,A,B,_,15,s[62]),B=l(B,x,T,A,y,21,s[63]),o[0]=o[0]+A|0,o[1]=o[1]+B|0,o[2]=o[2]+x|0,o[3]=o[3]+T|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var o=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,h=0;h<4;h++){var f=u[h];u[h]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,r,i,n,o,a){var s=t+(e&r|~e&i)+n+a;return(s<>>32-o)+e}function f(t,e,r,i,n,o,a){var s=t+(e&i|r&~i)+n+a;return(s<>>32-o)+e}function c(t,e,r,i,n,o,a){var s=t+(e^r^i)+n+a;return(s<>>32-o)+e}function l(t,e,r,i,n,o,a){var s=t+(r^(e|~i))+n+a;return(s<>>32-o)+e}r.MD5=o._createHelper(u),r.HmacMD5=o._createHmacHelper(u)}(Math),t.MD5},"object"==typeof _$md5_238?_$md5_238=_$md5_238=__factory_238(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_238):__factory_238(__root_238.CryptoJS);var _$sha1_254={},__root_254,__factory_254;__root_254=this,__factory_254=function(t){var e,r,i,n,o,a,s;return r=(e=t).lib,i=r.WordArray,n=r.Hasher,o=e.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=0;h<80;h++){if(h<16)a[h]=0|t[e+h];else{var f=a[h-3]^a[h-8]^a[h-14]^a[h-16];a[h]=f<<1|f>>>31}var c=(i<<5|i>>>27)+u+a[h];c+=h<20?1518500249+(n&o|~n&s):h<40?1859775393+(n^o^s):h<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,u=s,s=o,o=n<<30|n>>>2,n=i,i=c}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(i+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=n._createHelper(s),e.HmacSHA1=n._createHmacHelper(s),t.SHA1},"object"==typeof _$sha1_254?_$sha1_254=_$sha1_254=__factory_254(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_254):__factory_254(__root_254.CryptoJS);var _$sha256_256={},__root_256,__factory_256;__root_256=this,__factory_256=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=[],u=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(s[n]=r(e.pow(i,.5))),u[n]=r(e.pow(i,1/3)),n++),i++}();var h=[],f=a.SHA256=o.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],f=r[5],c=r[6],l=r[7],_=0;_<64;_++){if(_<16)h[_]=0|t[e+_];else{var d=h[_-15],p=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,m=h[_-2],b=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;h[_]=p+h[_-7]+b+h[_-16]}var g=i&n^i&o^n&o,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),y=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&c)+u[_]+h[_];l=c,c=f,f=s,s=a+y|0,a=o,o=n,n=i,i=y+(v+g)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+c|0,r[7]=r[7]+l|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=o._createHelper(f),r.HmacSHA256=o._createHmacHelper(f)}(Math),t.SHA256},"object"==typeof _$sha256_256?_$sha256_256=_$sha256_256=__factory_256(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_256):__factory_256(__root_256.CryptoJS);var _$sha224_255={},__root_255,__factory_255;__root_255=this,__factory_255=function(t){var e,r,i,n,o;return r=(e=t).lib.WordArray,i=e.algo,n=i.SHA256,o=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=n._createHelper(o),e.HmacSHA224=n._createHmacHelper(o),t.SHA224},"object"==typeof _$sha224_255?_$sha224_255=_$sha224_255=__factory_255(_$core_230,_$sha256_256):"function"==typeof define&&define.amd?define(["./core","./sha256"],__factory_255):__factory_255(__root_255.CryptoJS);var _$sha512_259={},__root_259,__factory_259;__root_259=this,__factory_259=function(t){return function(){var e=t,r=e.lib.Hasher,i=e.x64,n=i.Word,o=i.WordArray,a=e.algo;function s(){return n.create.apply(n,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],h=[];!function(){for(var t=0;t<80;t++)h[t]=s()}();var f=a.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],f=r[5],c=r[6],l=r[7],_=i.high,d=i.low,p=n.high,m=n.low,b=o.high,g=o.low,v=a.high,y=a.low,w=s.high,M=s.low,S=f.high,$=f.low,E=c.high,k=c.low,A=l.high,B=l.low,x=_,T=d,P=p,R=m,I=b,C=g,O=v,N=y,L=w,U=M,D=S,z=$,j=E,H=k,q=A,F=B,K=0;K<80;K++){var V,G,W=h[K];if(K<16)G=W.high=0|t[e+2*K],V=W.low=0|t[e+2*K+1];else{var Z=h[K-15],Y=Z.high,J=Z.low,X=(Y>>>1|J<<31)^(Y>>>8|J<<24)^Y>>>7,Q=(J>>>1|Y<<31)^(J>>>8|Y<<24)^(J>>>7|Y<<25),tt=h[K-2],et=tt.high,rt=tt.low,it=(et>>>19|rt<<13)^(et<<3|rt>>>29)^et>>>6,nt=(rt>>>19|et<<13)^(rt<<3|et>>>29)^(rt>>>6|et<<26),ot=h[K-7],at=ot.high,st=ot.low,ut=h[K-16],ht=ut.high,ft=ut.low;G=(G=(G=X+at+((V=Q+st)>>>0>>0?1:0))+it+((V+=nt)>>>0>>0?1:0))+ht+((V+=ft)>>>0>>0?1:0),W.high=G,W.low=V}var ct,lt=L&D^~L&j,_t=U&z^~U&H,dt=x&P^x&I^P&I,pt=T&R^T&C^R&C,mt=(x>>>28|T<<4)^(x<<30|T>>>2)^(x<<25|T>>>7),bt=(T>>>28|x<<4)^(T<<30|x>>>2)^(T<<25|x>>>7),gt=(L>>>14|U<<18)^(L>>>18|U<<14)^(L<<23|U>>>9),vt=(U>>>14|L<<18)^(U>>>18|L<<14)^(U<<23|L>>>9),yt=u[K],wt=yt.high,Mt=yt.low,St=q+gt+((ct=F+vt)>>>0>>0?1:0),$t=bt+pt;q=j,F=H,j=D,H=z,D=L,z=U,L=O+(St=(St=(St=St+lt+((ct+=_t)>>>0<_t>>>0?1:0))+wt+((ct+=Mt)>>>0>>0?1:0))+G+((ct+=V)>>>0>>0?1:0))+((U=N+ct|0)>>>0>>0?1:0)|0,O=I,N=C,I=P,C=R,P=x,R=T,x=St+(mt+dt+($t>>>0>>0?1:0))+((T=ct+$t|0)>>>0>>0?1:0)|0}d=i.low=d+T,i.high=_+x+(d>>>0>>0?1:0),m=n.low=m+R,n.high=p+P+(m>>>0>>0?1:0),g=o.low=g+C,o.high=b+I+(g>>>0>>0?1:0),y=a.low=y+N,a.high=v+O+(y>>>0>>0?1:0),M=s.low=M+U,s.high=w+L+(M>>>0>>0?1:0),$=f.low=$+z,f.high=S+D+($>>>0>>0?1:0),k=c.low=k+H,c.high=E+j+(k>>>0>>0?1:0),B=l.low=B+F,l.high=A+q+(B>>>0>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(i+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=r._createHelper(f),e.HmacSHA512=r._createHmacHelper(f)}(),t.SHA512},"object"==typeof _$sha512_259?_$sha512_259=_$sha512_259=__factory_259(_$core_230,_$x64Core_261):"function"==typeof define&&define.amd?define(["./core","./x64-core"],__factory_259):__factory_259(__root_259.CryptoJS);var _$sha384_258={},__root_258,__factory_258;__root_258=this,__factory_258=function(t){var e,r,i,n,o,a,s;return r=(e=t).x64,i=r.Word,n=r.WordArray,o=e.algo,a=o.SHA512,s=o.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s),t.SHA384},"object"==typeof _$sha384_258?_$sha384_258=_$sha384_258=__factory_258(_$core_230,_$x64Core_261,_$sha512_259):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],__factory_258):__factory_258(__root_258.CryptoJS);var _$sha3_257={},__root_257,__factory_257;__root_257=this,__factory_257=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.x64.Word,s=r.algo,u=[],h=[],f=[];!function(){for(var t=1,e=0,r=0;r<24;r++){u[t+5*e]=(r+1)*(r+2)/2%64;var i=(2*t+3*e)%5;t=e%5,e=i}for(t=0;t<5;t++)for(e=0;e<5;e++)h[t+5*e]=e+(2*t+3*e)%5*5;for(var n=1,o=0;o<24;o++){for(var s=0,c=0,l=0;l<7;l++){if(1&n){var _=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(B=r[n]).high^=a,B.low^=o}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var _=0,d=0,p=0;p<5;p++)_^=(B=r[l+5*p]).high,d^=B.low;var m=c[l];m.high=_,m.low=d}for(l=0;l<5;l++){var b=c[(l+4)%5],g=c[(l+1)%5],v=g.high,y=g.low;for(_=b.high^(v<<1|y>>>31),d=b.low^(y<<1|v>>>31),p=0;p<5;p++)(B=r[l+5*p]).high^=_,B.low^=d}for(var w=1;w<25;w++){var M=(B=r[w]).high,S=B.low,$=u[w];$<32?(_=M<<$|S>>>32-$,d=S<<$|M>>>32-$):(_=S<<$-32|M>>>64-$,d=M<<$-32|S>>>64-$);var E=c[h[w]];E.high=_,E.low=d}var k=c[0],A=r[0];for(k.high=A.high,k.low=A.low,l=0;l<5;l++)for(p=0;p<5;p++){var B=r[w=l+5*p],x=c[w],T=c[(l+1)%5+5*p],P=c[(l+2)%5+5*p];B.high=x.high^~T.high&P.high,B.low=x.low^~T.low&P.low}B=r[0];var R=f[s];B.high^=R.high,B.low^=R.low}},_doFinalize:function(){var t=this._data,r=t.words,i=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,h=[],f=0;f>>24)|4278255360&(l<<24|l>>>8),_=16711935&(_<<8|_>>>24)|4278255360&(_<<24|_>>>8),h.push(_),h.push(l)}return new n.init(h,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),r=0;r<25;r++)e[r]=e[r].clone();return t}});r.SHA3=o._createHelper(l),r.HmacSHA3=o._createHmacHelper(l)}(Math),t.SHA3},"object"==typeof _$sha3_257?_$sha3_257=_$sha3_257=__factory_257(_$core_230,_$x64Core_261):"function"==typeof define&&define.amd?define(["./core","./x64-core"],__factory_257):__factory_257(__root_257.CryptoJS);var _$ripemd160_253={},__root_253,__factory_253;__root_253=this,__factory_253=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=n.create([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=n.create([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]),h=n.create([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]),f=n.create([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=n.create([0,1518500249,1859775393,2400959708,2840853838]),l=n.create([1352829926,1548603684,1836072691,2053994217,0]),_=a.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=e+r,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o,a,_,y,w,M,S,$,E,k,A,B=this._hash.words,x=c.words,T=l.words,P=s.words,R=u.words,I=h.words,C=f.words;for(M=o=B[0],S=a=B[1],$=_=B[2],E=y=B[3],k=w=B[4],r=0;r<80;r+=1)A=o+t[e+P[r]]|0,A+=r<16?d(a,_,y)+x[0]:r<32?p(a,_,y)+x[1]:r<48?m(a,_,y)+x[2]:r<64?b(a,_,y)+x[3]:g(a,_,y)+x[4],A=(A=v(A|=0,I[r]))+w|0,o=w,w=y,y=v(_,10),_=a,a=A,A=M+t[e+R[r]]|0,A+=r<16?g(S,$,E)+T[0]:r<32?b(S,$,E)+T[1]:r<48?m(S,$,E)+T[2]:r<64?p(S,$,E)+T[3]:d(S,$,E)+T[4],A=(A=v(A|=0,C[r]))+k|0,M=k,k=E,E=v($,10),$=S,S=A;A=B[1]+_+E|0,B[1]=B[2]+y+k|0,B[2]=B[3]+w+M|0,B[3]=B[4]+o+S|0,B[4]=B[0]+a+$|0,B[0]=A},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process();for(var n=this._hash,o=n.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return n},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function d(t,e,r){return t^e^r}function p(t,e,r){return t&e|~t&r}function m(t,e,r){return(t|~e)^r}function b(t,e,r){return t&r|e&~r}function g(t,e,r){return t^(e|~r)}function v(t,e){return t<>>32-e}r.RIPEMD160=o._createHelper(_),r.HmacRIPEMD160=o._createHmacHelper(_)}(Math),t.RIPEMD160},"object"==typeof _$ripemd160_253?_$ripemd160_253=_$ripemd160_253=__factory_253(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_253):__factory_253(__root_253.CryptoJS);var _$hmac_235={},__root_235,__factory_235;__root_235=this,__factory_235=function(t){var e,r,i;r=(e=t).lib.Base,i=e.enc.Utf8,e.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),a=this._iKey=e.clone(),s=o.words,u=a.words,h=0;h>>2];t.sigBytes-=e}},p=(i.BlockCipher=f.extend({cfg:f.cfg.extend({mode:_,padding:d}),reset:function(){var t;f.reset.call(this);var e=this.cfg,r=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(i,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),i.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),m=(r.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(e):e).toString(u)},parse:function(t){var e,r=u.parse(t),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=o.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),p.create({ciphertext:r,salt:e})}},b=i.SerializableCipher=n.extend({cfg:n.extend({format:m}),encrypt:function(t,e,r,i){i=this.cfg.extend(i);var n=t.createEncryptor(r,i),o=n.finalize(e),a=n.cfg;return p.create({ciphertext:o,key:r,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,r,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(r,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),g=(r.kdf={}).OpenSSL={execute:function(t,e,r,i){i||(i=o.random(8));var n=h.create({keySize:e+r}).compute(t,i),a=o.create(n.words.slice(e),4*r);return n.sigBytes=4*e,p.create({key:n,iv:a,salt:i})}},v=i.PasswordBasedCipher=b.extend({cfg:b.cfg.extend({kdf:g}),encrypt:function(t,e,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,t.keySize,t.ivSize);i.iv=n.iv;var o=b.encrypt.call(this,t,e,n.key,i);return o.mixIn(n),o},decrypt:function(t,e,r,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=i.kdf.execute(r,t.keySize,t.ivSize,e.salt);return i.iv=n.iv,b.decrypt.call(this,t,e,n.key,i)}})}()},"object"==typeof _$cipherCore_229?_$cipherCore_229=_$cipherCore_229=__factory_229(_$core_230,_$evpkdf_233):"function"==typeof define&&define.amd?define(["./core","./evpkdf"],__factory_229):__factory_229(__root_229.CryptoJS);var _$modeCfb_239={},__root_239,__factory_239;__root_239=this,__factory_239=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function r(t,e,r,i){var n,o=this._iv;o?(n=o.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var e=t>>16&255,r=t>>8&255,i=255&t;255===e?(e=0,255===r?(r=0,255===i?i=0:++i):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=i}else t+=1<<24;return t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),function(t){0===(t[0]=r(t[0]))&&(t[1]=r(t[1]))}(a);var s=a.slice(0);i.encryptBlock(s,0);for(var u=0;u>>2]|=n<<24-o%4*8,t.sigBytes+=n},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923},"object"==typeof _$padAnsix923_244?_$padAnsix923_244=_$padAnsix923_244=__factory_244(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_244):__factory_244(__root_244.CryptoJS);var _$padIso10126_245={},__root_245,__factory_245;__root_245=this,__factory_245=function(t){return t.pad.Iso10126={pad:function(e,r){var i=4*r,n=i-e.sigBytes%i;e.concat(t.lib.WordArray.random(n-1)).concat(t.lib.WordArray.create([n<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126},"object"==typeof _$padIso10126_245?_$padIso10126_245=_$padIso10126_245=__factory_245(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_245):__factory_245(__root_245.CryptoJS);var _$padIso97971_246={},__root_246,__factory_246;__root_246=this,__factory_246=function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971},"object"==typeof _$padIso97971_246?_$padIso97971_246=_$padIso97971_246=__factory_246(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_246):__factory_246(__root_246.CryptoJS);var _$padZeropadding_248={},__root_248,__factory_248;__root_248=this,__factory_248=function(t){return t.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){var e=t.words,r=t.sigBytes-1;for(r=t.sigBytes-1;r>=0;r--)if(e[r>>>2]>>>24-r%4*8&255){t.sigBytes=r+1;break}}},t.pad.ZeroPadding},"object"==typeof _$padZeropadding_248?_$padZeropadding_248=_$padZeropadding_248=__factory_248(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_248):__factory_248(__root_248.CryptoJS);var _$padNopadding_247={},__root_247,__factory_247;__root_247=this,__factory_247=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding},"object"==typeof _$padNopadding_247?_$padNopadding_247=_$padNopadding_247=__factory_247(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_247):__factory_247(__root_247.CryptoJS);var _$formatHex_234={},__root_234,__factory_234;__root_234=this,__factory_234=function(t){var e,r,i;return r=(e=t).lib.CipherParams,i=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(i)},parse:function(t){var e=i.parse(t);return r.create({ciphertext:e})}},t.format.Hex},"object"==typeof _$formatHex_234?_$formatHex_234=_$formatHex_234=__factory_234(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_234):__factory_234(__root_234.CryptoJS);var _$aes_228={},__root_228,__factory_228;__root_228=this,__factory_228=function(t){return function(){var e=t,r=e.lib.BlockCipher,i=e.algo,n=[],o=[],a=[],s=[],u=[],h=[],f=[],c=[],l=[],_=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,i=0;for(e=0;e<256;e++){var d=i^i<<1^i<<2^i<<3^i<<4;d=d>>>8^255&d^99,n[r]=d,o[d]=r;var p=t[r],m=t[p],b=t[m],g=257*t[d]^16843008*d;a[r]=g<<24|g>>>8,s[r]=g<<16|g>>>16,u[r]=g<<8|g>>>24,h[r]=g,g=16843009*b^65537*m^257*p^16843008*r,f[d]=g<<24|g>>>8,c[d]=g<<16|g>>>16,l[d]=g<<8|g>>>24,_[d]=g,r?(r=p^t[t[t[b^p]]],i^=t[t[i]]):r=i=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],p=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,i=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a6&&a%r==4&&(h=n[h>>>24]<<24|n[h>>>16&255]<<16|n[h>>>8&255]<<8|n[255&h]):(h=n[(h=h<<8|h>>>24)>>>24]<<24|n[h>>>16&255]<<16|n[h>>>8&255]<<8|n[255&h],h^=d[a/r|0]<<24),o[a]=o[a-r]^h);for(var s=this._invKeySchedule=[],u=0;u>>24]]^c[n[h>>>16&255]]^l[n[h>>>8&255]]^_[n[255&h]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,s,u,h,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,f,c,l,_,o),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,i,n,o,a,s){for(var u=this._nRounds,h=t[e]^r[0],f=t[e+1]^r[1],c=t[e+2]^r[2],l=t[e+3]^r[3],_=4,d=1;d>>24]^n[f>>>16&255]^o[c>>>8&255]^a[255&l]^r[_++],m=i[f>>>24]^n[c>>>16&255]^o[l>>>8&255]^a[255&h]^r[_++],b=i[c>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&f]^r[_++],g=i[l>>>24]^n[h>>>16&255]^o[f>>>8&255]^a[255&c]^r[_++];h=p,f=m,c=b,l=g}p=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^r[_++],m=(s[f>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[_++],b=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^r[_++],g=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&c])^r[_++],t[e]=p,t[e+1]=m,t[e+2]=b,t[e+3]=g},keySize:8});e.AES=r._createHelper(p)}(),t.AES},"object"==typeof _$aes_228?_$aes_228=_$aes_228=__factory_228(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_228):__factory_228(__root_228.CryptoJS);var _$tripledes_260={},__root_260,__factory_260;__root_260=this,__factory_260=function(t){return function(){var e=t,r=e.lib,i=r.WordArray,n=r.BlockCipher,o=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=n.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var i=a[r]-1;e[r]=t[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],o=0;o<16;o++){var h=n[o]=[],f=u[o];for(r=0;r<24;r++)h[r/6|0]|=e[(s[r]-1+f)%28]<<31-r%6,h[4+(r/6|0)]|=e[28+(s[r+24]-1+f)%28]<<31-r%6;for(h[0]=h[0]<<1|h[0]>>>31,r=1;r<7;r++)h[r]=h[r]>>>4*(r-1)+3;h[7]=h[7]<<5|h[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=n[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],l.call(this,4,252645135),l.call(this,16,65535),_.call(this,2,858993459),_.call(this,8,16711935),l.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],o=this._lBlock,a=this._rBlock,s=0,u=0;u<8;u++)s|=h[u][((a^n[u])&f[u])>>>0];this._lBlock=a,this._rBlock=o^s}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,l.call(this,1,1431655765),_.call(this,8,16711935),_.call(this,2,858993459),l.call(this,16,65535),l.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function l(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),n=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(i.create(e)),this._des2=c.createEncryptor(i.create(r)),this._des3=c.createEncryptor(i.create(n))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(d)}(),t.TripleDES},"object"==typeof _$tripledes_260?_$tripledes_260=_$tripledes_260=__factory_260(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_260):__factory_260(__root_260.CryptoJS);var _$rc4_252={},__root_252,__factory_252;__root_252=this,__factory_252=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=i.RC4=r.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var o=0;n<256;n++){var a=n%r,s=e[a>>>2]>>>24-a%4*8&255;o=(o+i[n]+s)%256;var u=i[n];i[n]=i[o],i[o]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var t=this._S,e=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+t[e=(e+1)%256])%256;var o=t[e];t[e]=t[r],t[r]=o,i|=t[(t[e]+t[r])%256]<<24-8*n}return this._i=e,this._j=r,i}e.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)o.call(this)}});e.RC4Drop=r._createHelper(a)}(),t.RC4},"object"==typeof _$rc4_252?_$rc4_252=_$rc4_252=__factory_252(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_252):__factory_252(__root_252.CryptoJS);var _$rabbit_251={},__root_251,__factory_251;__root_251=this,__factory_251=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=[],o=[],a=[],s=i.Rabbit=r.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)u.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(e){var o=e.words,a=o[0],s=o[1],h=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),c=h>>>16|4294901760&f,l=f<<16|65535&h;for(n[0]^=h,n[1]^=c,n[2]^=f,n[3]^=l,n[4]^=h,n[5]^=c,n[6]^=f,n[7]^=l,r=0;r<4;r++)u.call(this)}},_doProcessBlock:function(t,e){var r=this._X;u.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,r=0;r<8;r++)o[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0,r=0;r<8;r++){var i=t[r]+e[r],n=65535&i,s=i>>>16,u=((n*n>>>17)+n*s>>>15)+s*s,h=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=u^h}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=r._createHelper(s)}(),t.Rabbit},"object"==typeof _$rabbit_251?_$rabbit_251=_$rabbit_251=__factory_251(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_251):__factory_251(__root_251.CryptoJS);var _$rabbitLegacy_250={},__root_250,__factory_250;__root_250=this,__factory_250=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=[],o=[],a=[],s=i.RabbitLegacy=r.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(e){var o=e.words,a=o[0],s=o[1],h=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),c=h>>>16|4294901760&f,l=f<<16|65535&h;for(i[0]^=h,i[1]^=c,i[2]^=f,i[3]^=l,i[4]^=h,i[5]^=c,i[6]^=f,i[7]^=l,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var r=this._X;u.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,r=0;r<8;r++)o[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0,r=0;r<8;r++){var i=t[r]+e[r],n=65535&i,s=i>>>16,u=((n*n>>>17)+n*s>>>15)+s*s,h=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=u^h}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=r._createHelper(s)}(),t.RabbitLegacy},"object"==typeof _$rabbitLegacy_250?_$rabbitLegacy_250=_$rabbitLegacy_250=__factory_250(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_250):__factory_250(__root_250.CryptoJS);var _$cryptoJs_236={},__root_236,__factory_236;__root_236=this,__factory_236=function(t){return t},"object"==typeof _$cryptoJs_236?_$cryptoJs_236=_$cryptoJs_236=__factory_236(_$core_230,_$x64Core_261,_$libTypedarrays_237,_$encUtf16_232,_$encBase64_231,_$md5_238,_$sha1_254,_$sha256_256,_$sha224_255,_$sha512_259,_$sha384_258,_$sha3_257,_$ripemd160_253,_$hmac_235,_$pbkdf2_249,_$evpkdf_233,_$cipherCore_229,_$modeCfb_239,_$modeCtr_241,_$modeCtrGladman_240,_$modeOfb_243,_$modeEcb_242,_$padAnsix923_244,_$padIso10126_245,_$padIso97971_246,_$padZeropadding_248,_$padNopadding_247,_$formatHex_234,_$aes_228,_$tripledes_260,_$rc4_252,_$rabbit_251,_$rabbitLegacy_250):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],__factory_236):__root_236.CryptoJS=__factory_236(__root_236.CryptoJS);const orgs=[{org:"psf",description:"Permissionless Software Foundation",website:"https://psfoundation.cash",addresses:{donations:"bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr"}},{org:"abc",description:"Bitcoin ABC",website:"https://www.bitcoinabc.org/",addresses:{donations:"bitcoincash:qqeht8vnwag20yv8dvtcrd4ujx09fwxwsqqqw93w88"}},{org:"bchd",description:"BCHD full node in Go",website:"https://bchd.cash/",addresses:{donations:"bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx"}}];var _$bchDonation_159=function(t){const e=orgs.filter(e=>e.org===t);if(!e)throw new Error("Could not find an organization with that handle.");if(e.length>1)throw new Error("Multiple organizations were found!");return e[0].addresses};let ___this_2;const PSF_DONATION=2e3;var _$sendBch_2=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.bchjs=new _$bchJs_6(t),___this_2=this}async sendBch(t,e,r){try{const i=await this.createTransaction(t,e,r);return await ___this_2.bchjs.RawTransactions.sendRawTransaction(i.hex)}catch(err){throw console.error("Error in send-bch.js/sendBch()"),err}}async createTransaction(t,e,r){try{if(!r||0===r.length)throw new Error("UTXO list is empty");e.fee||(e.fee=1);const{necessaryUtxos:i,change:n}=___this_2.getNecessaryUtxosAndChange(t,r,e.fee),o=new ___this_2.bchjs.TransactionBuilder;i.forEach(t=>{o.addInput(t.tx_hash,t.tx_pos)}),t.forEach(t=>{o.addOutput(t.address,t.amountSat)}),o.addOutput(_$bchDonation_159("psf").donations,PSF_DONATION),console.log("change: "+n),n&&n>546&&o.addOutput(e.cashAddress,n);const a=await ___this_2.getKeyPairFromMnemonic(e);i.forEach((t,e)=>{o.sign(e,a,void 0,o.hashTypes.SIGHASH_ALL,t.value)});const s=o.build();return{hex:s.toHex(),txid:s.getId()}}catch(err){throw console.error("Error in send-bch.js/createTransaction()"),err}}getNecessaryUtxosAndChange(t,e,r=1){const i=this.sortUtxosBySize(e,"ASCENDING"),n=___this_2.calculateFee(0,t.length+1,r);let o=t.reduce((t,e)=>t+e.amountSat,0)+n+PSF_DONATION,a=0;const s=[];for(const h of i)if(s.push(h),(a+=h.value)>=(o+=148))break;const u=a-o;if(u<0)throw console.error(`Available satoshis (${a}) below needed satoshis (${o}).`),new Error("Insufficient balance");return{necessaryUtxos:s,change:u}}sortUtxosBySize(t,e="ASCENDING"){return"ASCENDING"===e?t.sort((t,e)=>t.value-e.value):t.sort((t,e)=>e.value-t.value)}calculateFee(t,e,r){try{const i=___this_2.bchjs.BitcoinCash.getByteCount({P2PKH:t},{P2PKH:e+1}),n=Math.ceil(i*r);if(isNaN(n))throw new Error("Invalid input. Fee could not be calculated.");return n}catch(err){throw console.error("Error in send-bch.js/calculateFee()"),err}}async getKeyPairFromMnemonic(t){const e=await ___this_2.bchjs.Mnemonic.toSeed(t.mnemonic),r=___this_2.bchjs.HDNode.fromSeed(e),i=___this_2.bchjs.HDNode.derivePath(r,t.hdPath);return ___this_2.bchjs.HDNode.toKeyPair(i)}async sendAllBch(t,e,r){try{const i=await this.createSendAllTx(t,e,r);return await ___this_2.bchjs.RawTransactions.sendRawTransaction(i.hex)}catch(err){throw console.error("Error in send-bch.js/sendAllBch()"),err}}async createSendAllTx(t,e,r){try{if(!t||"string"!=typeof t)throw new Error("Address to send must be a bch address");if(!r||0===r.length)throw new Error("UTXO list is empty");const i=new ___this_2.bchjs.TransactionBuilder;e.fee||(e.fee=1);const n=e.fee;let o=0,a=this.calculateFee(0,2,n);a+=PSF_DONATION,r.forEach(t=>{o+=t.value,a+=148,i.addInput(t.tx_hash,t.tx_pos)}),i.addOutput(t,o-a),i.addOutput(_$bchDonation_159("psf").donations,PSF_DONATION);const s=await ___this_2.getKeyPairFromMnemonic(e);r.forEach((t,e)=>{i.sign(e,s,void 0,i.hashTypes.SIGHASH_ALL,t.value)});const u=i.build();return{hex:u.toHex(),txid:u.getId()}}catch(err){throw console.error("Error in send-bch.js/createSendAllTx()"),err}}};let ___this_4;var _$utxos_4=class{constructor(t){this.bchjs=new _$bchJs_6(t),this.utxoStore=[],this.bchUtxos=[],this.tokenUtxos=[],this.temp=[],___this_4=this}async getUtxos(t){try{const e=await ___this_4.bchjs.Electrumx.utxo(t);if(!e.success)throw new Error("Could not get UTXOs for "+t);return e.utxos}catch(err){throw console.error("Error in utxos.js/getUtxos()"),err}}async hydrate(t){try{if(!Array.isArray(t))throw new Error("Input must be an array");const e=20,r=await ___this_4.getArrayChunks(t,e);let i=[];for(let t=0;t(t.tokenQty&&(t.tokenQty=Number(t.tokenQty)),t)),this.utxoStore=r,this.getBchUtxos(),this.getTokenUtxos(),this.utxoStore}catch(err){throw console.error("Error in utxos.js/initUtxoStore()"),err}}getBchUtxos(){try{const t=this.utxoStore.filter(t=>!1===t.isValid);return this.bchUtxos=t,t}catch(err){throw console.log("Error in getBchUtxos()"),err}}getTokenUtxos(){try{const t=this.utxoStore.filter(t=>t.isValid);return this.tokenUtxos=t,t}catch(err){throw console.log("Error in getTokenUtxos()"),err}}diffUtxos(t){try{const e=___this_4.utxoStore,r=[];for(let i=0;i{if(!t.isValid||"token"!==t.utxoType)return;const r=e.findIndex(e=>e.tokenId===t.tokenId);if(r<0){const r={tokenId:t.tokenId,ticker:t.tokenTicker,name:t.tokenName,decimals:t.decimals,tokenType:t.tokenType,url:t.tokenDocumentUrl,qty:Number(t.tokenQty)};e.push(r)}else e[r].qty+=Number(t.tokenQty)}),e}catch(err){throw console.error("Error in tokens.js/listTokensFromUtxos()"),err}}async sendTokens(t,r,i,n,o=1){try{const a=await this.createTransaction(t,r,i,n,o);return await e.bchjs.RawTransactions.sendRawTransaction(a.hex)}catch(err){throw console.error("Error in tokens.js/sendTokens()"),err}}async createTransaction(r,i,n,o,a=1){try{if(!n||0===n.length)throw new Error("BCH UTXO list is empty");if(!o||0===o.length)throw new Error("Token UTXO list is empty");const s=r.tokenId;o=o.filter(t=>t.tokenId===s&&"token"===t.utxoType);const u=[{address:i.cashAddress,amountSat:500+50*a}],{necessaryUtxos:h,change:f}=e.sendBch.getNecessaryUtxosAndChange(u,n,a),c=new e.bchjs.TransactionBuilder;o.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)}),h.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)});let l={};if(1===o[0].tokenType)l=await e.bchjs.SLP.TokenType1.generateSendOpReturn(o,r.qty);else if(65===o[0].tokenType)l=await e.bchjs.SLP.NFT1.generateNFTChildSendOpReturn(o,r.qty);else{if(129!==o[0].tokenType)throw new Error(`Token Type ${o[0].tokenType} unknown`);l=await e.bchjs.SLP.NFT1.generateNFTGroupSendOpReturn(o,r.qty)}const _=t.from(l.script,"hex");c.addOutput(_,0),c.addOutput(e.bchjs.SLP.Address.toLegacyAddress(r.address),546),l.outputs>1&&c.addOutput(e.bchjs.SLP.Address.toLegacyAddress(i.address),546),c.addOutput(_$bchDonation_159("psf").donations,2e3),f&&f>546&&c.addOutput(i.cashAddress,f);const d=await e.sendBch.getKeyPairFromMnemonic(i);o.forEach((t,e)=>{c.sign(e,d,void 0,c.hashTypes.SIGHASH_ALL,t.value)}),h.forEach((t,e)=>{c.sign(o.length+e,d,void 0,c.hashTypes.SIGHASH_ALL,t.value)});const p=c.build();return{hex:p.toHex(),txid:p.getId()}}catch(err){throw console.error("Error in tokens.js/createTransaction()"),err}}}}).call(this,_$buffer_460({}).Buffer);var _$utxoMocks_395={mockUtxoStore:[{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:1,value:546,satoshis:546,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:1,utxoType:"token",transactionType:"send",tokenId:"a4fb5c2da1aa064e25018a43f9165040071d9e984ba190c222a7f59053af84b2",tokenTicker:"TROUT",tokenName:"Trout's test token",tokenDocumentUrl:"troutsblog.com",tokenDocumentHash:"",decimals:2,tokenType:1,tokenQty:2,isValid:!0},{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:4,value:2960,satoshis:2960,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:4,isValid:!1}],mockBchUtxos:[{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:4,value:2960,satoshis:2960,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:4,isValid:!1}],mockTokenUtxos:[{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:1,value:546,satoshis:546,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:1,utxoType:"token",transactionType:"send",tokenId:"a4fb5c2da1aa064e25018a43f9165040071d9e984ba190c222a7f59053af84b2",tokenTicker:"TROUT",tokenName:"Trout's test token",tokenDocumentUrl:"troutsblog.com",tokenDocumentHash:"",decimals:2,tokenType:1,tokenQty:1,isValid:!0}]};let ___this_1;var _$minimalSlpWallet_1=class{constructor(t,e){this.advancedOptions=e||{},this.hdPath=this.advancedOptions.hdPath||"m/44'/245'/0'/0/0";const r={};this.advancedOptions.restURL&&(r.restURL=e.restURL),this.advancedOptions.apiToken&&(r.apiToken=e.apiToken),this.fee=1.2,this.advancedOptions.fee&&(this.fee=this.advancedOptions.fee),this.isTest=!1,this.advancedOptions.test&&(this.isTest=!0),this.crypto=_$cryptoJs_236,this.BCHJS=_$bchJs_6,this.bchjs=new _$bchJs_6(r),this.sendBch=new _$sendBch_2(r),this.utxos=new _$utxos_4(r),this.tokens=new _$tokens_3(r),this.temp=[],___this_1=this,this.walletInfoCreated=!1,this.walletInfoPromise=this.create(t)}async create(t){try{t&&this.advancedOptions.password&&(t=this.decrypt(t,this.advancedOptions.password)),t=t||___this_1.bchjs.Mnemonic.generate(128);const e=await ___this_1.bchjs.Mnemonic.toSeed(t),r=___this_1.bchjs.HDNode.fromSeed(e).derivePath(this.hdPath),i=___this_1.bchjs.HDNode.toWIF(r),n=___this_1.bchjs.HDNode.toPublicKey(r),o={};this.advancedOptions.password&&(o.mnemonicEncrypted=this.encrypt(t,this.advancedOptions.password)),o.mnemonic=t,o.privateKey=i,o.publicKey=n.toString("hex"),o.address=o.cashAddress=___this_1.bchjs.HDNode.toCashAddress(r),o.slpAddress=___this_1.bchjs.SLP.Address.toSLPAddress(o.address),o.legacyAddress=___this_1.bchjs.HDNode.toLegacyAddress(r),o.hdPath=___this_1.hdPath,this.isTest?(___this_1.utxos.utxoStore=_$utxoMocks_395.mockUtxoStore,___this_1.utxos.bchUtxos=_$utxoMocks_395.mockBchUtxos,___this_1.utxos.tokenUtxos=_$utxoMocks_395.mockTokenUtxos):await ___this_1.utxos.initUtxoStore(o.address),___this_1.walletInfoCreated=!0,___this_1.walletInfo=o}catch(err){throw console.error("Error in create()"),err}}getUtxos(){return ___this_1.utxos.initUtxoStore()}encrypt(t,e){return this.crypto.AES.encrypt(t,e).toString()}decrypt(t,e){let r;try{r=this.crypto.AES.decrypt(t,e).toString(this.crypto.enc.Utf8)}catch(err){throw new Error("Wrong password")}return r}async getBalance(t){const e=t||this.walletInfo.cashAddress,r=await this.bchjs.Electrumx.balance(e);return r.balance.confirmed+r.balance.unconfirmed}async getTransactions(t){const e=t||this.walletInfo.cashAddress;return(await this.bchjs.Electrumx.transactions(e)).transactions.map(t=>t.tx_hash)}send(t){try{return ___this_1.sendBch.sendBch(t,{mnemonic:___this_1.walletInfo.mnemonic,cashAddress:___this_1.walletInfo.address,hdPath:___this_1.walletInfo.hdPath,fee:___this_1.fee},___this_1.utxos.bchUtxos)}catch(err){throw console.error("Error in send()"),err}}sendTokens(t,e){try{return e||(e=___this_1.fee),___this_1.tokens.sendTokens(t,___this_1.walletInfo,___this_1.utxos.bchUtxos,___this_1.utxos.tokenUtxos,e)}catch(err){throw console.error("Error in send()"),err}}listTokens(t){const e=t||this.walletInfo.slpAddress;return ___this_1.tokens.listTokensFromAddress(e)}sendAll(t){try{return ___this_1.sendBch.sendAllBch(t,{mnemonic:___this_1.walletInfo.mnemonic,cashAddress:___this_1.walletInfo.address,hdPath:___this_1.walletInfo.hdPath,fee:___this_1.fee},___this_1.utxos.bchUtxos)}catch(err){throw console.error("Error in sendAll()"),err}}};return _$minimalSlpWallet_1})); \ No newline at end of file +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SlpWallet=t()}}((function(){for(var define,module,exports,createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$cryptoBrowserify_469=createModuleFactory((function(t,e){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=_$browser_558,e.createHash=e.Hash=_$browser_465,e.createHmac=e.Hmac=_$browser_467;var r=Object.keys(_$algos_438),i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);e.getHashes=function(){return i},e.pbkdf2=_$browser_543.pbkdf2,e.pbkdf2Sync=_$browser_543.pbkdf2Sync,e.Cipher=_$browser_433.Cipher,e.createCipher=_$browser_433.createCipher,e.Cipheriv=_$browser_433.Cipheriv,e.createCipheriv=_$browser_433.createCipheriv,e.Decipher=_$browser_433.Decipher,e.createDecipher=_$browser_433.createDecipher,e.Decipheriv=_$browser_433.Decipheriv,e.createDecipheriv=_$browser_433.createDecipheriv,e.getCiphers=_$browser_433.getCiphers,e.listCiphers=_$browser_433.listCiphers,e.DiffieHellmanGroup=_$browser_476.DiffieHellmanGroup,e.createDiffieHellmanGroup=_$browser_476.createDiffieHellmanGroup,e.getDiffieHellman=_$browser_476.getDiffieHellman,e.createDiffieHellman=_$browser_476.createDiffieHellman,e.DiffieHellman=_$browser_476.DiffieHellman,e.createSign=_$browser_441.createSign,e.Sign=_$browser_441.Sign,e.createVerify=_$browser_441.createVerify,e.Verify=_$browser_441.Verify,e.createECDH=_$browser_463,e.publicEncrypt=_$browser_551.publicEncrypt,e.privateEncrypt=_$browser_551.privateEncrypt,e.publicDecrypt=_$browser_551.publicDecrypt,e.privateDecrypt=_$browser_551.privateDecrypt,e.randomFill=_$browser_559.randomFill,e.randomFillSync=_$browser_559.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),_$asn1_397=createModuleFactory((function(t,e){var r=e;r.bignum=_$bn_411,r.define=_$api_398({}).define,r.base=_$base_400({}),r.constants=_$constants_404({}),r.decoders=_$decoders_406({}),r.encoders=_$encoders_409({})})),_$encoders_409=createModuleFactory((function(t,e){var r=e;r.der=_$der_408({}),r.pem=_$pem_410({})})),_$pem_410=createModuleFactory((function(t,e){var r=_$der_408({});function i(t){r.call(this,t),this.enc="pem"}_$inherits_browser_530(i,r),t.exports=i,i.prototype.encode=function(t,e){for(var i=r.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"],o=0;o=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|o.tagClassByName[r||"universal"]<<6)}(t,e,i,this.reporter);if(n.length<128)return(a=new r(2))[0]=s,a[1]=n.length,this._createEncoderBuffer([a,n]);for(var u=1,h=n.length;h>=256;h>>=8)u++;(a=new r(2+u))[0]=s,a[1]=128|u,h=1+u;for(var f=n.length;f>0;h--,f>>=8)a[h]=255&f;return this._createEncoderBuffer([a,n])},s.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var i=new r(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;a>>=7)o++}var s=new r(o),u=s.length-1;for(n=t.length-1;n>=0;n--)for(a=t[n],s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a;return this._createEncoderBuffer(s)},s.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!r.isBuffer(t)){var i=t.toArray();!t.sign&&128&i[0]&&i.unshift(0),t=new r(i)}if(r.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new r(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var a=t;a>=256;a>>=8)n++;for(a=(o=new Array(n)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new r(o))},s.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},s.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:o.tag[r]}}function h(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?g(t,new b):S(t,h,e,!0);else if(h.ended)g(t,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?S(t,h,e,!1):A(t,h)):S(t,h,e,!1)}else i||(h.reading=!1,A(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(k,t))}function k(t){var e=t._readableState;n("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,P(t)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(B,t,r))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function T(t){n("readable nexttick read 0"),t.read(0)}function R(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),P(t),e.flowing&&!e.reading&&t.read(0)}function P(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function I(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 C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("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 N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=$(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?I(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&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){g(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?p:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",_),t.removeListener("finish",d),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",p),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,P(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),p(),t.removeListener("error",l),0===o(t,"error")&&g(t,e)}function _(){t.removeListener("finish",d),p()}function d(){n("onfinish"),t.removeListener("close",_),p()}function p(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",_),t.once("finish",d),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?E(this):o.reading||e.nextTick(T,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_457.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(x,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_457.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(x,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(R,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,B(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_452.destroy,M.prototype._undestroy=_$destroy_452.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$_stream_readable_504=createModuleFactory((function(t,e){(function(e,r){"use strict";var i;t.exports=w,w.ReadableState=y,_$events_498.EventEmitter;var n,o=function(t,e){return t.listeners(e).length},a=_$buffer_460({}).Buffer,s=r.Uint8Array||function(){},u=_$empty_415({});n=u&&u.debuglog?u.debuglog("stream"):function(){};var h,f,c,l=_$state_513.getHighWaterMark,_=_$errorsBrowser_501.codes,d=_.ERR_INVALID_ARG_TYPE,p=_.ERR_STREAM_PUSH_AFTER_EOF,m=_.ERR_METHOD_NOT_IMPLEMENTED,b=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;_$inherits_browser_530(w,_$streamBrowser_514);var g=_$destroy_509.errorOrDestroy,v=["error","close","destroy","pause","resume"];function y(t,e,r){i=i||_$Duplex_502({}),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=l(this,t,"readableHighWaterMark",r),this.buffer=new _$buffer_list_508,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=_$string_decoder_586({}).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function w(t){if(i=i||_$Duplex_502({}),!(this instanceof w))return new w(t);var e=this instanceof i;this._readableState=new y(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_514.call(this)}function M(t,e,r,i,o){n("readableAddChunk",e);var u,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(n("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?E(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,k(t)))}}(t,h);else if(o||(u=function(t,e){var r,i;return i=e,a.isBuffer(i)||i instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new d("chunk",["string","Buffer","Uint8Array"],e)),r}(h,e)),u)g(t,u);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?g(t,new b):S(t,h,e,!0);else if(h.ended)g(t,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?S(t,h,e,!1):A(t,h)):S(t,h,e,!1)}else i||(h.reading=!1,A(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(k,t))}function k(t){var e=t._readableState;n("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,P(t)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(B,t,r))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function T(t){n("readable nexttick read 0"),t.read(0)}function R(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),P(t),e.flowing&&!e.reading&&t.read(0)}function P(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function I(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 C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("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 N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=$(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?I(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&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){g(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?p:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",_),t.removeListener("finish",d),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",p),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,P(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),p(),t.removeListener("error",l),0===o(t,"error")&&g(t,e)}function _(){t.removeListener("finish",d),p()}function d(){n("onfinish"),t.removeListener("close",_),p()}function p(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",_),t.once("finish",d),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?E(this):o.reading||e.nextTick(T,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_514.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(x,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_514.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(x,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(R,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,B(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_509.destroy,M.prototype._undestroy=_$destroy_509.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$string_decoder_586=createModuleFactory((function(t,e){"use strict";var r=_$safeBuffer_576.Buffer,i=r.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 n(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&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=s,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=f,e=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.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,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(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 s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.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?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.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}})),_$Readable_563=createModuleFactory((function(t,e){(function(e,r){"use strict";var i;t.exports=_,_.ReadableState=l,_$events_498.EventEmitter;var n=function(t,e){return t.listeners(e).length},o=_$safeBuffer_569.Buffer,a=r.Uint8Array||function(){},s=Object.create(_$util_462);s.inherits=_$inherits_browser_530;var u,h=_$empty_415({}),f=void 0;f=h&&h.debuglog?h.debuglog("stream"):function(){},s.inherits(_,_$streamBrowser_568);var c=["error","close","destroy","pause","resume"];function l(t,e){t=t||{};var r=e instanceof(i=i||_$Duplex_561({}));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new _$BufferList_566,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(u||(u=_$string_decoder_570({}).StringDecoder),this.decoder=new u(t.encoding),this.encoding=t.encoding)}function _(t){if(i=i||_$Duplex_561({}),!(this instanceof _))return new _(t);this._readableState=new l(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_568.call(this)}function d(t,e,r,i,n){var s,u=t._readableState;return null===e?(u.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,b(t)}}(t,u)):(n||(s=function(t,e){var r,i;return i=e,o.isBuffer(i)||i instanceof a||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(u,e)),s?t.emit("error",s):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):p(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?p(t,u,e,!1):v(t,u)):p(t,u,e,!1))):i||(u.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(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;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_$processNextickArgs_549.nextTick(g,t):g(t))}function g(t){f("emit readable"),t.emit("readable"),S(t)}function v(t,e){e.readingMore||(e.readingMore=!0,_$processNextickArgs_549.nextTick(y,t,e))}function y(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 i;return to.length?o.length:t;if(a===o.length?n+=o:n+=o.slice(0,t),0==(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=o.allocUnsafe(t),i=e.head,n=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var a=i.data,s=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,s),0==(t-=s)){s===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(s));break}++n}return e.length-=n,r}(t,e),i}(t,e.buffer,e.decoder),r);var r}function E(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_$processNextickArgs_549.nextTick(k,e,t))}function k(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function A(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?E(this):b(this),null;if(0===(t=m(t,e))&&e.ended)return 0===e.length&&E(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?$(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&E(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,r){var i=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,f("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||t===e.stdout||t===e.stderr?m:s;function s(){f("onend"),t.end()}o.endEmitted?_$processNextickArgs_549.nextTick(a):i.once("end",a),t.on("unpipe",(function e(r,n){f("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",u),t.removeListener("error",_),t.removeListener("unpipe",e),i.removeListener("end",s),i.removeListener("end",m),i.removeListener("data",l),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,S(t))}}(i);t.on("drain",u);var h=!1,c=!1;function l(e){f("ondata"),c=!1,!1!==t.write(e)||c||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==A(o.pipes,t))&&!h&&(f("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,c=!0),i.pause())}function _(e){f("onerror",e),m(),t.removeListener("error",_),0===n(t,"error")&&t.emit("error",e)}function d(){t.removeListener("finish",p),m()}function p(){f("onfinish"),t.removeListener("close",d),m()}function m(){f("unpipe"),i.unpipe(t)}return i.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?_$isarray_532(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,_),t.once("close",d),t.once("finish",p),t.emit("pipe",i),o.flowing||(f("pipe resume"),i.resume()),t},_.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>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,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(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 s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.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?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.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}})),_$Duplex_561=createModuleFactory((function(t,e){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var i=Object.create(_$util_462);i.inherits=_$inherits_browser_530;var n=_$Readable_563({}),o=_$Writable_565({});i.inherits(h,n);for(var a=r(o.prototype),s=0;s-1?i:_$processNextickArgs_549.nextTick;d.WritableState=_;var s=Object.create(_$util_462);s.inherits=_$inherits_browser_530;var u,h={deprecate:_$browser_588},f=_$safeBuffer_569.Buffer,c=r.Uint8Array||function(){};function l(){}function _(t,e){o=o||_$Duplex_561({}),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,s=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:u,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===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(_$processNextickArgs_549.nextTick(n,i),_$processNextickArgs_549.nextTick(y,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),y(t,e))}(t,r,i,e,n);else{var o=g(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||b(t,r),i?a(m,t,r,o,n):m(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function d(t){if(o=o||_$Duplex_561({}),!(u.call(d,this)||this instanceof o))return new d(t);this._writableState=new _(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),_$streamBrowser_568.call(this)}function p(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function m(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),y(t,e)}function b(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,o=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,p(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(p(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function g(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function v(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),y(t,e)}))}function y(t,e){var r=g(e);return r&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,_$processNextickArgs_549.nextTick(v,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}s.inherits(d,_$streamBrowser_568),_.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(_.prototype,"buffer",{get: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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(d,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||this===d&&t&&t._writableState instanceof _}})):u=function(t){return t instanceof this},d.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},d.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,a=!n.objectMode&&(i=t,f.isBuffer(i)||i instanceof c);return a&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=l),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),_$processNextickArgs_549.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!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),_$processNextickArgs_549.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.pendingcb++,o=function(t,e,r,i,n,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=e.objectMode?1:i.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),d.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},d.prototype._writev=null,d.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,y(t,e),r&&(e.finished?_$processNextickArgs_549.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),d.prototype.destroy=_$destroy_567.destroy,d.prototype._undestroy=_$destroy_567.undestroy,d.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$main_587({}).setImmediate)})),_$main_587=createModuleFactory((function(t,e){(function(t,r){var i=_$browser_550.nextTick,n=(Function.prototype.apply,Array.prototype.slice),o={},a=0;function s(t,e){this._id=t,this._clearFn=e}s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(window,this._id)},e.setImmediate="function"==typeof t?t:function(t){var r=a++,s=!(arguments.length<2)&&n.call(arguments,1);return o[r]=!0,i((function(){o[r]&&(s?t.apply(null,s):t.call(null),e.clearImmediate(r))})),r},e.clearImmediate="function"==typeof r?r:function(t){delete o[t]}}).call(this,_$main_587({}).setImmediate,_$main_587({}).clearImmediate)})),_$_stream_readable_292=createModuleFactory((function(t,e){(function(e,r){"use strict";var i;t.exports=w,w.ReadableState=y,_$events_498.EventEmitter;var n,o=function(t,e){return t.listeners(e).length},a=_$buffer_460({}).Buffer,s=r.Uint8Array||function(){},u=_$empty_415({});n=u&&u.debuglog?u.debuglog("stream"):function(){};var h,f,c,l=_$state_301.getHighWaterMark,_=_$errorsBrowser_289.codes,d=_.ERR_INVALID_ARG_TYPE,p=_.ERR_STREAM_PUSH_AFTER_EOF,m=_.ERR_METHOD_NOT_IMPLEMENTED,b=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;_$inherits_browser_317(w,_$streamBrowser_302);var g=_$destroy_297.errorOrDestroy,v=["error","close","destroy","pause","resume"];function y(t,e,r){i=i||_$Duplex_290({}),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=l(this,t,"readableHighWaterMark",r),this.buffer=new _$buffer_list_296,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=_$string_decoder_370({}).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function w(t){if(i=i||_$Duplex_290({}),!(this instanceof w))return new w(t);var e=this instanceof i;this._readableState=new y(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_302.call(this)}function M(t,e,r,i,o){n("readableAddChunk",e);var u,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(n("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?E(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,k(t)))}}(t,h);else if(o||(u=function(t,e){var r,i;return i=e,a.isBuffer(i)||i instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new d("chunk",["string","Buffer","Uint8Array"],e)),r}(h,e)),u)g(t,u);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?g(t,new b):S(t,h,e,!0);else if(h.ended)g(t,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?S(t,h,e,!1):A(t,h)):S(t,h,e,!1)}else i||(h.reading=!1,A(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(k,t))}function k(t){var e=t._readableState;n("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,P(t)}function A(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(B,t,r))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function T(t){n("readable nexttick read 0"),t.read(0)}function R(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),P(t),e.flowing&&!e.reading&&t.read(0)}function P(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function I(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 C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("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 N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=$(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?I(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&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){g(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?p:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",_),t.removeListener("finish",d),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",p),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,P(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),p(),t.removeListener("error",l),0===o(t,"error")&&g(t,e)}function _(){t.removeListener("finish",d),p()}function d(){n("onfinish"),t.removeListener("close",_),p()}function p(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",_),t.once("finish",d),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.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 i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?E(this):o.reading||e.nextTick(T,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_302.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(x,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_302.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(x,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(R,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a>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,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(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 s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.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?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.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}})),_$Duplex_290=createModuleFactory((function(t,e){(function(e){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=u;var i=_$_stream_readable_292({}),n=_$_stream_writable_294({});_$inherits_browser_317(u,i);for(var o=r(n.prototype),a=0;a-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,B(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_297.destroy,M.prototype._undestroy=_$destroy_297.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$empty_415=createModuleFactory((function(t,e){})),_$buffer_460=createModuleFactory((function(t,e){(function(t){"use strict";e.Buffer=t,e.SlowBuffer=function(e){return+e!=e&&(e=0),t.alloc(+e)},e.INSPECT_MAX_BYTES=50;function r(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return r.__proto__=t.prototype,r}function t(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 o(t)}return i(t,e,r)}function i(e,i,n){if("string"==typeof e)return function(e,i){if("string"==typeof i&&""!==i||(i="utf8"),!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i);var n=0|u(e,i),o=r(n),a=o.write(e,i);return a!==n&&(o=o.slice(0,a)),o}(e,i);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer))return function(e,r,i){if(r<0||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function u(e,r){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return P(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return I(e).length;default:if(o)return n?-1:P(e).length;r=(""+r).toLowerCase(),o=!0}}function h(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function f(e,r,i,n,o){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),N(i=+i)&&(i=o?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(o)return-1;i=e.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof r&&(r=t.from(r,n)),t.isBuffer(r))return 0===r.length?-1:c(e,r,i,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,i):Uint8Array.prototype.lastIndexOf.call(e,r,i):c(e,[r],i,n,o);throw new TypeError("val must be string, number or Buffer")}function c(t,e,r,i,n){var o,a=1,s=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;ln&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var a=0;a>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function g(t,e,r){return 0===e&&r===t.length?_$base64Js_412.fromByteArray(t):_$base64Js_412.fromByteArray(t.slice(e,r))}function v(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[n+1]))&&(u=(31&h)<<6|63&o)>127&&(f=u);break;case 3:o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(u=(15&h)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&h)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=c}return function(t){var e=t.length;if(e<=y)return String.fromCharCode.apply(String,t);for(var r="",i=0;ithis.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 S(this,e,r);case"utf8":case"utf-8":return v(this,e,r);case"ascii":return w(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},t.prototype.compare=function(e,r,i,n,o){if(O(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(r>>>=0),u=Math.min(a,s),h=this.slice(n,o),f=e.slice(r,i),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return l(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return d(this,t,e,r);case"latin1":case"binary":return p(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var y=4096;function w(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function k(e,r,i,n,o,a){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function A(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,i,n){return e=+e,r>>>=0,n||A(t,0,r,4),_$ieee754_529.write(t,e,r,i,23,4),r+4}function x(t,e,r,i,n){return e=+e,r>>>=0,n||A(t,0,r,8),_$ieee754_529.write(t,e,r,i,52,8),r+8}t.prototype.slice=function(e,r){var i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(r=void 0===r?i:~~r)<0?(r+=i)<0&&(r=0):r>i&&(r=i),r>>=0,e>>>=0,r||E(t,e,this.length);for(var i=this[t],n=1,o=0;++o>>=0,e>>>=0,r||E(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},t.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},t.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),_$ieee754_529.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),_$ieee754_529.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),_$ieee754_529.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),_$ieee754_529.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||k(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||k(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},t.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},t.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},t.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);k(this,t,e,r,n-1,-n)}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},t.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},t.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||k(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},t.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return x(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return x(this,t,e,!1,r)},t.prototype.copy=function(e,r,i,n){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r=0;--a)e[a+r]=this[a+i];else Uint8Array.prototype.set.call(e,this.subarray(i,n),r);return o},t.prototype.fill=function(e,r,i,n){if("string"==typeof e){if("string"==typeof r?(n=r,r=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!t.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e&&(e&=255);if(r<0||this.length>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(a=r;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=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 I(t){return _$base64Js_412.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function O(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this,_$buffer_460({}).Buffer)})),_$base64Js_412={toByteArray:function(t){var e,r,i=getLens(t),n=i[0],o=i[1],a=new Arr(function(t,e,r){return 3*(e+r)/4-r}(0,n,o)),s=0,u=o>0?n-4:n;for(r=0;r>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===o&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[s++]=255&e),1===o&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,a=r-i;oa?a:o+16383));return 1===i?(e=t[r-1],n.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],n.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),n.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var i,n,o=[],a=e;a>18&63]+lookup[n>>12&63]+lookup[n>>6&63]+lookup[63&n]);return o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_529={read:function(t,e,r,i,n){var o,a,s=8*n-i-1,u=(1<>1,f=-7,c=r?n-1:0,l=r?-1:1,_=t[e+c];for(c+=l,o=_&(1<<-f)-1,_>>=-f,f+=s;f>0;o=256*o+t[e+c],c+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=i;f>0;a=256*a+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return a?NaN:1/0*(_?-1:1);a+=Math.pow(2,i),o-=h}return(_?-1:1)*a*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var a,s,u,h=8*o-n-1,f=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,_=i?0:o-1,d=i?1:-1,p=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=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(e*u-1)*Math.pow(2,n),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[r+_]=255&s,_+=d,s/=256,n-=8);for(a=a<0;t[r+_]=255&a,_+=d,a/=256,h-=8);t[r+_-d]|=128*p}},_$safeBuffer_345={},buffer=_$buffer_460({}),Buffer=buffer.Buffer;function copyProps(t,e){for(var r in t)e[r]=t[r]}function SafeBuffer(t,e,r){return Buffer(t,e,r)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?_$safeBuffer_345=buffer:(copyProps(buffer,_$safeBuffer_345),_$safeBuffer_345.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(Buffer.prototype),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return Buffer(t,e,r)},SafeBuffer.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=Buffer(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return Buffer(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(t)};var __Buffer_187=_$safeBuffer_345.Buffer,_$bip66_187={check:function(t){if(t.length<8)return!1;if(t.length>72)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-2)return!1;if(2!==t[2])return!1;var e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},decode:function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");var e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");var r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},encode:function(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var n=__Buffer_187.allocUnsafe(6+r+i);return n[0]=48,n[1]=n.length-2,n[2]=2,n[3]=t.length,t.copy(n,4),n[4+r]=2,n[5+r]=e.length,e.copy(n,6+r),n}},_$index_38={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKDATASIG:186,OP_CHECKDATASIGVERIFY:187,OP_REVERSEBYTES:188,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};function encodingLength(t){return t<_$index_38.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}var _$pushdataBitcoin_97={encodingLength:encodingLength,encode:function(t,e,r){var i=encodingLength(e);return 1===i?t.writeUInt8(e,r):2===i?(t.writeUInt8(_$index_38.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===i?(t.writeUInt8(_$index_38.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(_$index_38.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),i},decode:function(t,e){var r,i,n=t.readUInt8(e);if(n<_$index_38.OP_PUSHDATA1)r=n,i=1;else if(n===_$index_38.OP_PUSHDATA1){if(e+2>t.length)return null;r=t.readUInt8(e+1),i=2}else if(n===_$index_38.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(n!==_$index_38.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:n,number:r,size:i}}},types={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 typeName in types.Null=types.Nil,types)types[typeName].toJSON=function(t){return t}.bind(null,typeName);var _$types_389=types,_$errors_386={};function getTypeName(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName(t){return _$types_389.Nil(t)?"":getTypeName(t.constructor)}function captureStackTrace(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function tfJSON(t){return _$types_389.Function(t)?t.toJSON?t.toJSON():getTypeName(t):_$types_389.Array(t)?"Array":t&&_$types_389.Object(t)?"Object":void 0!==t?t:""}function tfErrorString(t,e,r){var i=function(t){return _$types_389.Function(t)?"":_$types_389.String(t)?JSON.stringify(t):t&&_$types_389.Object(t)?"":t}(e);return"Expected "+tfJSON(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function TfTypeError(t,e,r){r=r||getValueTypeName(e),this.message=tfErrorString(t,e,r),captureStackTrace(this,TfTypeError),this.__type=t,this.__value=e,this.__valueTypeName=r}function TfPropertyTypeError(t,e,r,i,n){t?(n=n||getValueTypeName(i),this.message=function(t,e,r,i,n){var o='" of type ';return"key"===e&&(o='" with key type '),tfErrorString('property "'+tfJSON(r)+o+tfJSON(t),i,n)}(t,r,e,i,n)):this.message='Unexpected property "'+e+'"',captureStackTrace(this,TfTypeError),this.__label=r,this.__property=e,this.__type=t,this.__value=i,this.__valueTypeName=n}function isBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}TfTypeError.prototype=Object.create(Error.prototype),TfTypeError.prototype.constructor=TfTypeError,TfPropertyTypeError.prototype=Object.create(Error.prototype),TfPropertyTypeError.prototype.constructor=TfTypeError,_$errors_386={TfTypeError:TfTypeError,TfPropertyTypeError:TfPropertyTypeError,tfCustomError:function(t,e){return new TfTypeError(t,{},e)},tfSubError:function(t,e,r){return t instanceof TfPropertyTypeError?(e=e+"."+t.__property,t=new TfPropertyTypeError(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof TfTypeError&&(t=new TfPropertyTypeError(t.__type,e,r,t.__value,t.__valueTypeName)),captureStackTrace(t),t},tfJSON:tfJSON,getValueTypeName:getValueTypeName};var _$isBuffer_531=function(t){return null!=t&&(isBuffer(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isBuffer(t.slice(0,0))}(t)||!!t._isBuffer)},_$types_387={};(function(t){function e(e){return t.isBuffer(e)}function r(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function i(t,e){var r=t.toJSON();function i(i){if(!t(i))return!1;if(i.length===e)return!0;throw _$errors_386.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+i.length+")")}return i.toJSON=function(){return r},i}var n=i.bind(null,_$types_389.Array),o=i.bind(null,e),a=i.bind(null,r),s=i.bind(null,_$types_389.String),u=Math.pow(2,53)-1,h={ArrayN:n,Buffer:e,BufferN:o,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:r,HexN:a,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>=-u&&t<=u&&Math.floor(t)===t},Range:function(t,e,r){function i(i,n){return r(i,n)&&i>t&&i>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=u&&Math.floor(t)===t}};for(var f in h)h[f].toJSON=function(t){return t}.bind(null,f);_$types_387=h}).call(this,{isBuffer:_$isBuffer_531});var _$typeforce_388={},__tfJSON_388=_$errors_386.tfJSON,__TfTypeError_388=_$errors_386.TfTypeError,__TfPropertyTypeError_388=_$errors_386.TfPropertyTypeError,tfSubError=_$errors_386.tfSubError,__getValueTypeName_388=_$errors_386.getValueTypeName,TYPES={arrayOf:function(t,e){function r(r,i){return!!_$types_389.Array(r)&&!_$types_389.Nil(r)&&!(void 0!==e.minLength&&r.lengthe.maxLength)&&(void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return typeforce(t,e,i)}catch(n){throw tfSubError(n,r)}}))}return t=compile(t),e=e||{},r.toJSON=function(){var r="["+__tfJSON_388(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,i){return _$types_389.Nil(r)||e(r,i,t)}return e=compile(e),r.toJSON=function(){return"?"+__tfJSON_388(e)},r},map:function(t,e){function r(r,i){if(!_$types_389.Object(r))return!1;if(_$types_389.Nil(r))return!1;for(var n in r){try{e&&typeforce(e,n,i)}catch(a){throw tfSubError(a,n,"key")}try{var o=r[n];typeforce(t,o,i)}catch(a){throw tfSubError(a,n)}}return!0}return t=compile(t),e&&(e=compile(e)),r.toJSON=e?function(){return"{"+__tfJSON_388(e)+": "+__tfJSON_388(t)+"}"}:function(){return"{"+__tfJSON_388(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=compile(t[r]);function i(t,r){if(!_$types_389.Object(t))return!1;if(_$types_389.Nil(t))return!1;var i;try{for(i in e)typeforce(e[i],t[i],r)}catch(n){throw tfSubError(n,i)}if(r)for(i in t)if(!e[i])throw new __TfPropertyTypeError_388(void 0,i);return!0}return i.toJSON=function(){return __tfJSON_388(e)},i},anyOf:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return t.some((function(t){try{return typeforce(t,e,r)}catch(i){return!1}}))}return e.toJSON=function(){return t.map(__tfJSON_388).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return t.every((function(t){try{return typeforce(t,e,r)}catch(i){return!1}}))}return e.toJSON=function(){return t.map(__tfJSON_388).join(" & ")},e},quacksLike:function(t){function e(e){return t===__getValueTypeName_388(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return!_$types_389.Nil(e)&&!_$types_389.Nil(e.length)&&(!r||e.length===t.length)&&t.every((function(t,i){try{return typeforce(t,e[i],r)}catch(n){throw tfSubError(n,i)}}))}return e.toJSON=function(){return"("+t.map(__tfJSON_388).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function compile(t){if(_$types_389.String(t))return"?"===t[0]?TYPES.maybe(t.slice(1)):_$types_389[t]||TYPES.quacksLike(t);if(t&&_$types_389.Object(t)){if(_$types_389.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(t[0])}return TYPES.object(t)}return _$types_389.Function(t)?t:TYPES.value(t)}function typeforce(t,e,r,i){if(_$types_389.Function(t)){if(t(e,r))return!0;throw new __TfTypeError_388(i||t,e)}return typeforce(compile(t),e,r)}for(var __typeName_388 in TYPES.oneOf=TYPES.anyOf,_$types_389)typeforce[__typeName_388]=_$types_389[__typeName_388];for(__typeName_388 in TYPES)typeforce[__typeName_388]=TYPES[__typeName_388];for(__typeName_388 in _$types_387)typeforce[__typeName_388]=_$types_387[__typeName_388];typeforce.compile=compile,typeforce.TfTypeError=__TfTypeError_388,typeforce.TfPropertyTypeError=__TfPropertyTypeError_388,_$typeforce_388=typeforce;var UINT31_MAX=Math.pow(2,31)-1;function BIP32Path(t){return _$typeforce_388.String(t)&&t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}BIP32Path.toJSON=function(){return"BIP32 derivation path"};var SATOSHI_MAX=21e14,__BigInt_78=_$typeforce_388.quacksLike("BigInteger"),ECPoint=_$typeforce_388.quacksLike("Point"),ECSignature=_$typeforce_388.compile({r:__BigInt_78,s:__BigInt_78}),Network=_$typeforce_388.compile({messagePrefix:_$typeforce_388.oneOf(_$typeforce_388.Buffer,_$typeforce_388.String),bip32:{public:_$typeforce_388.UInt32,private:_$typeforce_388.UInt32},pubKeyHash:_$typeforce_388.UInt8,scriptHash:_$typeforce_388.UInt8,wif:_$typeforce_388.UInt8}),__types_78={BigInt:__BigInt_78,BIP32Path:BIP32Path,Buffer256bit:_$typeforce_388.BufferN(32),ECPoint:ECPoint,ECSignature:ECSignature,Hash160bit:_$typeforce_388.BufferN(20),Hash256bit:_$typeforce_388.BufferN(32),Network:Network,Satoshi:function(t){return _$typeforce_388.UInt53(t)&&t<=SATOSHI_MAX},UInt31:function(t){return _$typeforce_388.UInt32(t)&&t<=UINT31_MAX}};for(var __typeName_78 in _$typeforce_388)__types_78[__typeName_78]=_$typeforce_388[__typeName_78];var _$types_78=__types_78,map={};for(var op in _$index_38)map[_$index_38[op]]=op;var _$map_39=map,__Buffer_53=_$safeBuffer_345.Buffer,_$script_number_53={decode:function(t,e,r){e=e||4,r=void 0===r||r;var i=t.length;if(0===i)return 0;if(i>e)throw new TypeError("Script number overflow");if(r&&0==(127&t[i-1])&&(i<=1||0==(128&t[i-2])))throw new Error("Non-minimally encoded script number");if(5===i){var n=t.readUInt32LE(0),o=t.readUInt8(4);return 128&o?-(4294967296*(-129&o)+n):4294967296*o+n}for(var a=0,s=0;s2147483647?5:t>8388607?4:t>32767?3:t>127?2:t>0?1:0}(e),i=__Buffer_53.allocUnsafe(r),n=t<0,o=0;o>=8;return 128&i[r-1]?i.writeUInt8(n?128:0,r-1):n&&(i[r-1]|=128),i}},__Buffer_52=_$safeBuffer_345.Buffer,OP_INT_BASE=_$index_38.OP_RESERVED;function isPushOnlyChunk(t){return _$types_78.Buffer(t)||function(t){return _$types_78.Number(t)&&(t===_$index_38.OP_0||t>=_$index_38.OP_1&&t<=_$index_38.OP_16||t===_$index_38.OP_1NEGATE)}(t)}function isPushOnly(t){return _$types_78.Array(t)&&t.every(isPushOnlyChunk)}function asMinimalOP(t){return 0===t.length?_$index_38.OP_0:1===t.length?t[0]>=1&&t[0]<=16?OP_INT_BASE+t[0]:129===t[0]?_$index_38.OP_1NEGATE:void 0:void 0}function __compile_52(t){if(__Buffer_52.isBuffer(t))return t;_$typeforce_388(_$types_78.Array,t);var e=t.reduce((function(t,e){return __Buffer_52.isBuffer(e)?1===e.length&&void 0!==asMinimalOP(e)?t+1:t+_$pushdataBitcoin_97.encodingLength(e.length)+e.length:t+1}),0),r=__Buffer_52.allocUnsafe(e),i=0;if(t.forEach((function(t){if(__Buffer_52.isBuffer(t)){var e=asMinimalOP(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=_$pushdataBitcoin_97.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function decompile(t){if(_$types_78.Array(t))return t;_$typeforce_388(_$types_78.Buffer,t);for(var e=[],r=0;r_$index_38.OP_0&&i<=_$index_38.OP_PUSHDATA4){var n=_$pushdataBitcoin_97.decode(t,r);if(null===n)return[];r+=n.size;var o=t.slice(r,r+n.number);r+=n.number;var a=asMinimalOP(o);void 0!==a?e.push(a):e.push(o)}else e.push(i),r+=1}return e}function isDefinedHashType(t){var e=-193&t;return e>0&&e<4}var _$script_52={compile:__compile_52,compile2:function(t){if(__Buffer_52.isBuffer(t))return t;var e=t.reduce((function(t,e){return __Buffer_52.isBuffer(e)?t+_$pushdataBitcoin_97.encodingLength(e.length)+e.length:t+1}),0),r=__Buffer_52.allocUnsafe(e),i=0;if(t.forEach((function(t,e){__Buffer_52.isBuffer(t)?(i+=_$pushdataBitcoin_97.encode(r,t.length,i),t.copy(r,i),i+=t.length):(r.writeUInt8(t,i),i+=1)})),i!==r.length)throw new Error("Could not decode chunks");return r},decompile:decompile,fromASM:function(t){return _$typeforce_388(_$types_78.String,t),__compile_52(t.split(" ").map((function(t){return void 0!==_$index_38[t]?_$index_38[t]:__Buffer_52.from(t,"hex")})))},toASM:function(t){return __Buffer_52.isBuffer(t)&&(t=decompile(t)),t.map((function(t){if(__Buffer_52.isBuffer(t)){var e=asMinimalOP(t);if(void 0===e)return t.toString("hex");t=e}return _$map_39[t]})).join(" ")},toStack:function(t){return t=decompile(t),_$typeforce_388(isPushOnly,t),t.map((function(t){return __Buffer_52.isBuffer(t)?t:t===_$index_38.OP_0?__Buffer_52.allocUnsafe(0):_$script_number_53.encode(t-OP_INT_BASE)}))},number:_$script_number_53,isCanonicalPubKey:function(t){if(!__Buffer_52.isBuffer(t))return!1;if(t.length<33)return!1;switch(t[0]){case 2:case 3:return 33===t.length;case 4:return 65===t.length}return!1},isCanonicalSignature:function(t){return!!__Buffer_52.isBuffer(t)&&!!isDefinedHashType(t[t.length-1])&&(65===t.length||_$bip66_187.check(t.slice(0,-1)))},isPushOnly:isPushOnly,isDefinedHashType:isDefinedHashType},_$output_57={},__OP_INT_BASE_57=_$index_38.OP_RESERVED;function check(t,e){var r=_$script_52.decompile(t);if(r.length<4)return!1;if(r[r.length-1]!==_$index_38.OP_CHECKMULTISIG)return!1;if(!_$types_78.Number(r[0]))return!1;if(!_$types_78.Number(r[r.length-2]))return!1;var i=r[0]-__OP_INT_BASE_57,n=r[r.length-2]-__OP_INT_BASE_57;return!(i<=0)&&!(n>16)&&!(i>n)&&n===r.length-3&&(!!e||r.slice(1,-2).every(_$script_52.isCanonicalPubKey))}check.toJSON=function(){return"multi-sig output"},_$output_57={check:check,decode:function(t,e){var r=_$script_52.decompile(t);return _$typeforce_388(check,r,e),{m:r[0]-__OP_INT_BASE_57,pubKeys:r.slice(1,-2)}},encode:function(t,e){_$typeforce_388({m:_$types_78.Number,pubKeys:[_$script_52.isCanonicalPubKey]},{m:t,pubKeys:e});var r=e.length;if(rr.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(EMPTY_BUFFER,t.map((function(t){return t===_$index_38.OP_0?EMPTY_BUFFER:t})))}function decodeStack(t,e){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_56,t,e),t.slice(1)}var _$input_56={check:__check_56,decode:function(t,e){return decodeStack(_$script_52.decompile(t),e)},decodeStack:decodeStack,encode:function(t,e){return _$script_52.compile(encodeStack(t,e))},encodeStack:encodeStack},_$multisig_55={input:_$input_56,output:_$output_57},_$nulldata_58={};function __check_58(t){var e=_$script_52.compile(t);return e.length>1&&e[0]===_$index_38.OP_RETURN}__check_58.toJSON=function(){return"null data output"},_$nulldata_58={output:{check:__check_58,decode:function(t){return _$typeforce_388(__check_58,t),t.slice(2)},encode:function(t){return _$typeforce_388(_$types_78.Buffer,t),_$script_52.compile([_$index_38.OP_RETURN,t])}}};var _$input_60={};function __check_60(t){var e=_$script_52.decompile(t);return 1===e.length&&_$script_52.isCanonicalSignature(e[0])}function __encodeStack_60(t){return _$typeforce_388(_$script_52.isCanonicalSignature,t),[t]}function __decodeStack_60(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_60,t),t[0]}__check_60.toJSON=function(){return"pubKey input"},_$input_60={check:__check_60,decode:function(t){return __decodeStack_60(_$script_52.decompile(t))},decodeStack:__decodeStack_60,encode:function(t){return _$script_52.compile(__encodeStack_60(t))},encodeStack:__encodeStack_60};var _$output_61={};function __check_61(t){var e=_$script_52.decompile(t);return 2===e.length&&_$script_52.isCanonicalPubKey(e[0])&&e[1]===_$index_38.OP_CHECKSIG}__check_61.toJSON=function(){return"pubKey output"},_$output_61={check:__check_61,decode:function(t){var e=_$script_52.decompile(t);return _$typeforce_388(__check_61,e),e[0]},encode:function(t){return _$typeforce_388(_$script_52.isCanonicalPubKey,t),_$script_52.compile([t,_$index_38.OP_CHECKSIG])}};var _$pubkey_59={input:_$input_60,output:_$output_61},_$input_63={};function __check_63(t){var e=_$script_52.decompile(t);return 2===e.length&&_$script_52.isCanonicalSignature(e[0])&&_$script_52.isCanonicalPubKey(e[1])}function __encodeStack_63(t,e){return _$typeforce_388({signature:_$script_52.isCanonicalSignature,pubKey:_$script_52.isCanonicalPubKey},{signature:t,pubKey:e}),[t,e]}function __decodeStack_63(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_63,t),{signature:t[0],pubKey:t[1]}}__check_63.toJSON=function(){return"pubKeyHash input"},_$input_63={check:__check_63,decode:function(t){return __decodeStack_63(_$script_52.decompile(t))},decodeStack:__decodeStack_63,encode:function(t,e){return _$script_52.compile(__encodeStack_63(t,e))},encodeStack:__encodeStack_63};var _$output_64={};function __check_64(t){var e=_$script_52.compile(t);return 25===e.length&&e[0]===_$index_38.OP_DUP&&e[1]===_$index_38.OP_HASH160&&20===e[2]&&e[23]===_$index_38.OP_EQUALVERIFY&&e[24]===_$index_38.OP_CHECKSIG}__check_64.toJSON=function(){return"pubKeyHash output"},_$output_64={check:__check_64,decode:function(t){return _$typeforce_388(__check_64,t),t.slice(3,23)},encode:function(t){return _$typeforce_388(_$types_78.Hash160bit,t),_$script_52.compile([_$index_38.OP_DUP,_$index_38.OP_HASH160,t,_$index_38.OP_EQUALVERIFY,_$index_38.OP_CHECKSIG])}};var _$pubkeyhash_62={input:_$input_63,output:_$output_64},_$output_72={};function __check_72(t){var e=_$script_52.compile(t);return 22===e.length&&e[0]===_$index_38.OP_0&&20===e[1]}__check_72.toJSON=function(){return"Witness pubKeyHash output"},_$output_72={check:__check_72,decode:function(t){return _$typeforce_388(__check_72,t),t.slice(2)},encode:function(t){return _$typeforce_388(_$types_78.Hash160bit,t),_$script_52.compile([_$index_38.OP_0,t])}};var _$output_75={};function __check_75(t){var e=_$script_52.compile(t);return 34===e.length&&e[0]===_$index_38.OP_0&&32===e[1]}__check_75.toJSON=function(){return"Witness scriptHash output"},_$output_75={check:__check_75,decode:function(t){return _$typeforce_388(__check_75,t),t.slice(2)},encode:function(t){return _$typeforce_388(_$types_78.Hash256bit,t),_$script_52.compile([_$index_38.OP_0,t])}};var _$input_66={},__Buffer_66=_$safeBuffer_345.Buffer;function __check_66(t,e){var r=_$script_52.decompile(t);if(r.length<1)return!1;var i=r[r.length-1];if(!__Buffer_66.isBuffer(i))return!1;var n=_$script_52.decompile(_$script_52.compile(r.slice(0,-1))),o=_$script_52.decompile(i);return 0!==o.length&&!!_$script_52.isPushOnly(n)&&(1===r.length?_$output_75.check(o)||_$output_72.check(o):!(!_$pubkeyhash_62.input.check(n)||!_$pubkeyhash_62.output.check(o))||!(!_$multisig_55.input.check(n,e)||!_$multisig_55.output.check(o))||!(!_$pubkey_59.input.check(n)||!_$pubkey_59.output.check(o)))}function __encodeStack_66(t,e){var r=_$script_52.compile(e);return[].concat(t,r)}function __decodeStack_66(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_66,t),{redeemScriptStack:t.slice(0,-1),redeemScript:t[t.length-1]}}__check_66.toJSON=function(){return"scriptHash input"},_$input_66={check:__check_66,decode:function(t){var e=__decodeStack_66(_$script_52.decompile(t));return e.redeemScriptSig=_$script_52.compile(e.redeemScriptStack),delete e.redeemScriptStack,e},decodeStack:__decodeStack_66,encode:function(t,e){var r=_$script_52.decompile(t);return _$script_52.compile(__encodeStack_66(r,e))},encodeStack:__encodeStack_66};var _$output_67={};function __check_67(t){var e=_$script_52.compile(t);return 23===e.length&&e[0]===_$index_38.OP_HASH160&&20===e[1]&&e[22]===_$index_38.OP_EQUAL}__check_67.toJSON=function(){return"scriptHash output"},_$output_67={check:__check_67,decode:function(t){return _$typeforce_388(__check_67,t),t.slice(2,22)},encode:function(t){return _$typeforce_388(_$types_78.Hash160bit,t),_$script_52.compile([_$index_38.OP_HASH160,t,_$index_38.OP_EQUAL])}};var _$scripthash_65={input:_$input_66,output:_$output_67},_$input_71={};function isCompressedCanonicalPubKey(t){return _$script_52.isCanonicalPubKey(t)&&33===t.length}function __check_71(t){var e=_$script_52.decompile(t);return 2===e.length&&_$script_52.isCanonicalSignature(e[0])&&isCompressedCanonicalPubKey(e[1])}__check_71.toJSON=function(){return"witnessPubKeyHash input"},_$input_71={check:__check_71,decodeStack:function(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(__check_71,t),{signature:t[0],pubKey:t[1]}},encodeStack:function(t,e){return _$typeforce_388({signature:_$script_52.isCanonicalSignature,pubKey:isCompressedCanonicalPubKey},{signature:t,pubKey:e}),[t,e]}};var _$witnesspubkeyhash_70={input:_$input_71,output:_$output_72},_$input_74={};(function(t){function e(e,r){if(_$typeforce_388(_$types_78.Array,e),e.length<1)return!1;var i=e[e.length-1];if(!t.isBuffer(i))return!1;var n=_$script_52.decompile(i);if(0===n.length)return!1;var o=_$script_52.compile(e.slice(0,-1));return!(!_$pubkeyhash_62.input.check(o)||!_$pubkeyhash_62.output.check(n))||!(!_$multisig_55.input.check(o,r)||!_$multisig_55.output.check(n))||!(!_$pubkey_59.input.check(o)||!_$pubkey_59.output.check(n))}e.toJSON=function(){return"witnessScriptHash input"},_$input_74={check:e,decodeStack:function(t){return _$typeforce_388(_$typeforce_388.Array,t),_$typeforce_388(e,t),{witnessData:t.slice(0,-1),witnessScript:t[t.length-1]}},encodeStack:function(t,e){return _$typeforce_388({witnessData:[_$types_78.Buffer],witnessScript:_$types_78.Buffer},{witnessData:t,witnessScript:e}),[].concat(t,e)}}}).call(this,{isBuffer:_$isBuffer_531});var _$witnessscripthash_73={input:_$input_74,output:_$output_75},_$output_69={},__Buffer_69=_$safeBuffer_345.Buffer,HEADER=__Buffer_69.from("aa21a9ed","hex");function __check_69(t){var e=_$script_52.compile(t);return e.length>37&&e[0]===_$index_38.OP_RETURN&&36===e[1]&&e.slice(2,6).equals(HEADER)}__check_69.toJSON=function(){return"Witness commitment output"},_$output_69={check:__check_69,decode:function(t){return _$typeforce_388(__check_69,t),_$script_52.decompile(t)[1].slice(4,36)},encode:function(t){_$typeforce_388(_$types_78.Hash256bit,t);var e=__Buffer_69.allocUnsafe(36);return HEADER.copy(e,0),t.copy(e,4),_$script_52.compile([_$index_38.OP_RETURN,e])}};for(var _$witnesscommitment_68={output:_$output_69},__decompile_54=_$script_52.decompile,__types_54={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"},_$templates_54={classifyInput:function(t,e){var r=__decompile_54(t);return _$pubkeyhash_62.input.check(r)?__types_54.P2PKH:_$scripthash_65.input.check(r,e)?__types_54.P2SH:_$multisig_55.input.check(r,e)?__types_54.MULTISIG:_$pubkey_59.input.check(r)?__types_54.P2PK:__types_54.NONSTANDARD},classifyOutput:function(t){if(_$witnesspubkeyhash_70.output.check(t))return __types_54.P2WPKH;if(_$witnessscripthash_73.output.check(t))return __types_54.P2WSH;if(_$pubkeyhash_62.output.check(t))return __types_54.P2PKH;if(_$scripthash_65.output.check(t))return __types_54.P2SH;var e=__decompile_54(t);return _$multisig_55.output.check(e)?__types_54.MULTISIG:_$pubkey_59.output.check(e)?__types_54.P2PK:_$witnesscommitment_68.output.check(e)?__types_54.WITNESS_COMMITMENT:_$nulldata_58.output.check(e)?__types_54.NULLDATA:__types_54.NONSTANDARD},classifyWitness:function(t,e){var r=__decompile_54(t);return _$witnesspubkeyhash_70.input.check(r)?__types_54.P2WPKH:_$witnessscripthash_73.input.check(r,e)?__types_54.P2WSH:__types_54.NONSTANDARD},multisig:_$multisig_55,nullData:_$nulldata_58,pubKey:_$pubkey_59,pubKeyHash:_$pubkeyhash_62,scriptHash:_$scripthash_65,witnessPubKeyHash:_$witnesspubkeyhash_70,witnessScriptHash:_$witnessscripthash_73,witnessCommitment:_$witnesscommitment_68,types:__types_54},ALPHABET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={},z=0;z>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function prefixChk(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=polymodStep(e)^i>>5}for(e=polymodStep(e),r=0;re)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),a=t.slice(n+1);if(a.length<6)return"Data too short";var s=prefixChk(o);if("string"==typeof s)return s;for(var u=[],h=0;h=a.length||u.push(c)}return 1!==s?"Invalid checksum for "+t:{prefix:o,words:u}}function convert(t,e,r,i){for(var n=0,o=0,a=(1<=r;)o-=r,s.push(n>>o&a);if(i)o>0&&s.push(n<=e)return"Excess padding";if(n<r)throw new TypeError("Exceeds length limit");var i=prefixChk(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");i=polymodStep(i)^a,n+=ALPHABET.charAt(a)}for(o=0;o<6;++o)i=polymodStep(i);for(i^=1,o=0;o<6;++o){var s=i>>5*(5-o)&31;n+=ALPHABET.charAt(s)}return n},toWords:function(t){var e=convert(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWords:function(t){var e=convert(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}},_$inherits_browser_317={};_$inherits_browser_317="function"==typeof Object.create?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var _$events_498={},objectCreate=Object.create||function(t){var e=function(){};return e.prototype=t,new e},objectKeys=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},bind=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function EventEmitter(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=objectCreate(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}_$events_498=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0;var hasDefineProperty,defaultMaxListeners=10;try{var o={};Object.defineProperty&&Object.defineProperty(o,"x",{value:0}),hasDefineProperty=0===o.x}catch(err){hasDefineProperty=!1}function $getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function _addListener(t,e,r,i){var n,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]):(o=t._events=objectCreate(null),t._eventsCount=0),a){if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(n=$getMaxListeners(t))&&n>0&&a.length>n){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else a=o[e]=r,++t._eventsCount;return t}function onceWrapper(){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 u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(r=a[t]))return!1;var h="function"==typeof r;switch(i=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var i=t.length,n=arrayClone(t,i),o=0;o=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(t,e){for(var r=e,i=r+1,n=t.length;i=0;i--)this.removeListener(t,e[i]);return this},EventEmitter.prototype.listeners=function(t){return _listeners(this,t,!0)},EventEmitter.prototype.rawListeners=function(t){return _listeners(this,t,!1)},EventEmitter.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):listenerCount.call(t,e)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var _$streamBrowser_302=_$events_498.EventEmitter;function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _defineProperties(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 __Buffer_296.alloc(0);for(var e,r,i,n=__Buffer_296.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_296.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_296.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:custom,value:function(t,e){return inspect(this,function(t){for(var e=1;e1)for(var r=1;r2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(oneOf(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(oneOf(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_289.codes=codes;var ERR_INVALID_OPT_VALUE=_$errorsBrowser_289.codes.ERR_INVALID_OPT_VALUE,_$state_301={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new ERR_INVALID_OPT_VALUE(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$browser_391={};(function(t){function e(e){try{if(!t.localStorage)return!1}catch(i){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}_$browser_391=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$safeBuffer_371={},__buffer_371=_$buffer_460({}),__Buffer_371=__buffer_371.Buffer;function __copyProps_371(t,e){for(var r in t)e[r]=t[r]}function __SafeBuffer_371(t,e,r){return __Buffer_371(t,e,r)}__Buffer_371.from&&__Buffer_371.alloc&&__Buffer_371.allocUnsafe&&__Buffer_371.allocUnsafeSlow?_$safeBuffer_371=__buffer_371:(__copyProps_371(__buffer_371,_$safeBuffer_371),_$safeBuffer_371.Buffer=__SafeBuffer_371),__copyProps_371(__Buffer_371,__SafeBuffer_371),__SafeBuffer_371.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return __Buffer_371(t,e,r)},__SafeBuffer_371.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=__Buffer_371(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},__SafeBuffer_371.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __Buffer_371(t)},__SafeBuffer_371.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __buffer_371.SlowBuffer(t)};var _$Transform_293=Transform,_require$codes=_$errorsBrowser_289.codes,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=_require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=_require$codes.ERR_TRANSFORM_WITH_LENGTH_0,Duplex=_$Duplex_290({});function afterTransform(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new ERR_MULTIPLE_CALLBACK);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(call),a||(o.forEach(call),n(i))}))}));return e.reduce(pipe)},_$readableBrowser_303={};_$readableBrowser_303=_$readableBrowser_303=_$_stream_readable_292({}),_$readableBrowser_303.Stream=_$readableBrowser_303,_$readableBrowser_303.Readable=_$readableBrowser_303,_$readableBrowser_303.Writable=_$_stream_writable_294({}),_$readableBrowser_303.Duplex=_$Duplex_290({}),_$readableBrowser_303.Transform=_$Transform_293,_$readableBrowser_303.PassThrough=_$PassThrough_291,_$readableBrowser_303.finished=_$eos_298({}),_$readableBrowser_303.pipeline=_$pipeline_300;var _$hashBase_288={},__Buffer_288=_$safeBuffer_345.Buffer,__Transform_288=_$readableBrowser_303.Transform;function HashBase(t){__Transform_288.call(this),this._block=__Buffer_288.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}_$inherits_browser_317(HashBase,__Transform_288),HashBase.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(err){i=err}r(i)},HashBase.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(err){e=err}t(e)},HashBase.prototype.update=function(t,e){if(function(t,e){if(!__Buffer_288.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");__Buffer_288.isBuffer(t)||(t=__Buffer_288.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var n=this._blockOffset;n0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},_$hashBase_288=HashBase;var _$md5Js_321={},__Buffer_321=_$safeBuffer_345.Buffer,ARRAY16=new Array(16);function MD5(){_$hashBase_288.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(t,e){return t<>>32-e}function fnF(t,e,r,i,n,o,a){return rotl(t+(e&r|~e&i)+n+o|0,a)+e|0}function fnG(t,e,r,i,n,o,a){return rotl(t+(e&i|r&~i)+n+o|0,a)+e|0}function fnH(t,e,r,i,n,o,a){return rotl(t+(e^r^i)+n+o|0,a)+e|0}function fnI(t,e,r,i,n,o,a){return rotl(t+(r^(e|~i))+n+o|0,a)+e|0}_$inherits_browser_317(MD5,_$hashBase_288),MD5.prototype._update=function(){for(var t=ARRAY16,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=fnF(r,i,n,o,t[0],3614090360,7),o=fnF(o,r,i,n,t[1],3905402710,12),n=fnF(n,o,r,i,t[2],606105819,17),i=fnF(i,n,o,r,t[3],3250441966,22),r=fnF(r,i,n,o,t[4],4118548399,7),o=fnF(o,r,i,n,t[5],1200080426,12),n=fnF(n,o,r,i,t[6],2821735955,17),i=fnF(i,n,o,r,t[7],4249261313,22),r=fnF(r,i,n,o,t[8],1770035416,7),o=fnF(o,r,i,n,t[9],2336552879,12),n=fnF(n,o,r,i,t[10],4294925233,17),i=fnF(i,n,o,r,t[11],2304563134,22),r=fnF(r,i,n,o,t[12],1804603682,7),o=fnF(o,r,i,n,t[13],4254626195,12),n=fnF(n,o,r,i,t[14],2792965006,17),r=fnG(r,i=fnF(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=fnG(o,r,i,n,t[6],3225465664,9),n=fnG(n,o,r,i,t[11],643717713,14),i=fnG(i,n,o,r,t[0],3921069994,20),r=fnG(r,i,n,o,t[5],3593408605,5),o=fnG(o,r,i,n,t[10],38016083,9),n=fnG(n,o,r,i,t[15],3634488961,14),i=fnG(i,n,o,r,t[4],3889429448,20),r=fnG(r,i,n,o,t[9],568446438,5),o=fnG(o,r,i,n,t[14],3275163606,9),n=fnG(n,o,r,i,t[3],4107603335,14),i=fnG(i,n,o,r,t[8],1163531501,20),r=fnG(r,i,n,o,t[13],2850285829,5),o=fnG(o,r,i,n,t[2],4243563512,9),n=fnG(n,o,r,i,t[7],1735328473,14),r=fnH(r,i=fnG(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=fnH(o,r,i,n,t[8],2272392833,11),n=fnH(n,o,r,i,t[11],1839030562,16),i=fnH(i,n,o,r,t[14],4259657740,23),r=fnH(r,i,n,o,t[1],2763975236,4),o=fnH(o,r,i,n,t[4],1272893353,11),n=fnH(n,o,r,i,t[7],4139469664,16),i=fnH(i,n,o,r,t[10],3200236656,23),r=fnH(r,i,n,o,t[13],681279174,4),o=fnH(o,r,i,n,t[0],3936430074,11),n=fnH(n,o,r,i,t[3],3572445317,16),i=fnH(i,n,o,r,t[6],76029189,23),r=fnH(r,i,n,o,t[9],3654602809,4),o=fnH(o,r,i,n,t[12],3873151461,11),n=fnH(n,o,r,i,t[15],530742520,16),r=fnI(r,i=fnH(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=fnI(o,r,i,n,t[7],1126891415,10),n=fnI(n,o,r,i,t[14],2878612391,15),i=fnI(i,n,o,r,t[5],4237533241,21),r=fnI(r,i,n,o,t[12],1700485571,6),o=fnI(o,r,i,n,t[3],2399980690,10),n=fnI(n,o,r,i,t[10],4293915773,15),i=fnI(i,n,o,r,t[1],2240044497,21),r=fnI(r,i,n,o,t[8],1873313359,6),o=fnI(o,r,i,n,t[15],4264355552,10),n=fnI(n,o,r,i,t[6],2734768916,15),i=fnI(i,n,o,r,t[13],1309151649,21),r=fnI(r,i,n,o,t[4],4149444226,6),o=fnI(o,r,i,n,t[11],3174756917,10),n=fnI(n,o,r,i,t[2],718787259,15),i=fnI(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=__Buffer_321.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},_$md5Js_321=MD5;var _$ripemd160_344={},__Buffer_344=_$buffer_460({}).Buffer,__ARRAY16_344=new Array(16),zl=[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],zr=[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],sl=[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],sr=[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],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){_$hashBase_288.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function __rotl_344(t,e){return t<>>32-e}function fn1(t,e,r,i,n,o,a,s){return __rotl_344(t+(e^r^i)+o+a|0,s)+n|0}function fn2(t,e,r,i,n,o,a,s){return __rotl_344(t+(e&r|~e&i)+o+a|0,s)+n|0}function fn3(t,e,r,i,n,o,a,s){return __rotl_344(t+((e|~r)^i)+o+a|0,s)+n|0}function fn4(t,e,r,i,n,o,a,s){return __rotl_344(t+(e&i|r&~i)+o+a|0,s)+n|0}function fn5(t,e,r,i,n,o,a,s){return __rotl_344(t+(e^(r|~i))+o+a|0,s)+n|0}_$inherits_browser_317(RIPEMD160,_$hashBase_288),RIPEMD160.prototype._update=function(){for(var t=__ARRAY16_344,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,f=0|this._d,c=0|this._e,l=0;l<80;l+=1){var _,d;l<16?(_=fn1(r,i,n,o,a,t[zl[l]],hl[0],sl[l]),d=fn5(s,u,h,f,c,t[zr[l]],hr[0],sr[l])):l<32?(_=fn2(r,i,n,o,a,t[zl[l]],hl[1],sl[l]),d=fn4(s,u,h,f,c,t[zr[l]],hr[1],sr[l])):l<48?(_=fn3(r,i,n,o,a,t[zl[l]],hl[2],sl[l]),d=fn3(s,u,h,f,c,t[zr[l]],hr[2],sr[l])):l<64?(_=fn4(r,i,n,o,a,t[zl[l]],hl[3],sl[l]),d=fn2(s,u,h,f,c,t[zr[l]],hr[3],sr[l])):(_=fn5(r,i,n,o,a,t[zl[l]],hl[4],sl[l]),d=fn1(s,u,h,f,c,t[zr[l]],hr[4],sr[l])),r=a,a=o,o=__rotl_344(n,10),n=i,i=_,s=c,c=f,f=__rotl_344(h,10),h=u,u=d}var p=this._b+n+f|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+i+h|0,this._a=p},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=__Buffer_344.alloc?__Buffer_344.alloc(20):new __Buffer_344(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},_$ripemd160_344=RIPEMD160;var _$hash_357={},__Buffer_357=_$safeBuffer_345.Buffer;function Hash(t,e){this._block=__Buffer_357.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Hash.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=__Buffer_357.from(t,e));for(var r=this._block,i=this._blockSize,n=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_$hash_357=Hash;var _$sha_359={},__Buffer_359=_$safeBuffer_345.Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha(){this.init(),this._w=W,_$hash_357.call(this,64,56)}function rotl30(t){return t<<30|t>>>2}function ft(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_317(Sha,_$hash_357),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var f=~~(h/20),c=0|((e=i)<<5|e>>>27)+ft(f,n,o,a)+s+r[h]+K[f];s=a,a=o,o=rotl30(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Sha.prototype._hash=function(){var t=__Buffer_359.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},_$sha_359=Sha;var _$sha1_360={},__Buffer_360=_$safeBuffer_345.Buffer,__K_360=[1518500249,1859775393,-1894007588,-899497514],__W_360=new Array(80);function Sha1(){this.init(),this._w=__W_360,_$hash_357.call(this,64,56)}function rotl5(t){return t<<5|t>>>27}function __rotl30_360(t){return t<<30|t>>>2}function __ft_360(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_317(Sha1,_$hash_357),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=(e=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|e>>>31;for(var h=0;h<80;++h){var f=~~(h/20),c=rotl5(i)+__ft_360(f,n,o,a)+s+r[h]+__K_360[f]|0;s=a,a=o,o=__rotl30_360(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Sha1.prototype._hash=function(){var t=__Buffer_360.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},_$sha1_360=Sha1;var _$sha256_362={},__Buffer_362=_$safeBuffer_345.Buffer,__K_362=[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],__W_362=new Array(64);function Sha256(){this.init(),this._w=__W_362,_$hash_357.call(this,64,56)}function ch(t,e,r){return r^t&(e^r)}function maj(t,e,r){return t&e|r&(t|e)}function sigma0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sigma1(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function gamma0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}_$inherits_browser_317(Sha256,_$hash_357),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,f=0|this._h,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<64;++c)r[c]=0|(((e=r[c-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[c-7]+gamma0(r[c-15])+r[c-16];for(var l=0;l<64;++l){var _=f+sigma1(s)+ch(s,u,h)+__K_362[l]+r[l]|0,d=sigma0(i)+maj(i,n,o)|0;f=h,h=u,u=s,s=a+_|0,a=o,o=n,n=i,i=_+d|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=f+this._h|0},Sha256.prototype._hash=function(){var t=__Buffer_362.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},_$sha256_362=Sha256;var _$sha224_361={},__Buffer_361=_$safeBuffer_345.Buffer,__W_361=new Array(64);function Sha224(){this.init(),this._w=__W_361,_$hash_357.call(this,64,56)}_$inherits_browser_317(Sha224,_$sha256_362),Sha224.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},Sha224.prototype._hash=function(){var t=__Buffer_361.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},_$sha224_361=Sha224;var _$sha512_364={},__Buffer_364=_$safeBuffer_345.Buffer,__K_364=[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],__W_364=new Array(160);function Sha512(){this.init(),this._w=__W_364,_$hash_357.call(this,128,112)}function Ch(t,e,r){return r^t&(e^r)}function __maj_364(t,e,r){return t&e|r&(t|e)}function __sigma0_364(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function __sigma1_364(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Gamma0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Gamma0l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function Gamma1(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Gamma1l(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function getCarry(t,e){return t>>>0>>0?1:0}_$inherits_browser_317(Sha512,_$hash_357),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,f=0|this._al,c=0|this._bl,l=0|this._cl,_=0|this._dl,d=0|this._el,p=0|this._fl,m=0|this._gl,b=0|this._hl,g=0;g<32;g+=2)e[g]=t.readInt32BE(4*g),e[g+1]=t.readInt32BE(4*g+4);for(;g<160;g+=2){var v=e[g-30],y=e[g-30+1],w=Gamma0(v,y),M=Gamma0l(y,v),S=Gamma1(v=e[g-4],y=e[g-4+1]),$=Gamma1l(y,v),E=e[g-14],k=e[g-14+1],A=e[g-32],B=e[g-32+1],x=M+k|0,T=w+E+getCarry(x,M)|0;T=(T=T+S+getCarry(x=x+$|0,$)|0)+A+getCarry(x=x+B|0,B)|0,e[g]=T,e[g+1]=x}for(var R=0;R<160;R+=2){T=e[R],x=e[R+1];var P=__maj_364(r,i,n),I=__maj_364(f,c,l),C=__sigma0_364(r,f),O=__sigma0_364(f,r),N=__sigma1_364(a,d),L=__sigma1_364(d,a),U=__K_364[R],D=__K_364[R+1],z=Ch(a,s,u),j=Ch(d,p,m),H=b+L|0,q=h+N+getCarry(H,b)|0;q=(q=(q=q+z+getCarry(H=H+j|0,j)|0)+U+getCarry(H=H+D|0,D)|0)+T+getCarry(H=H+x|0,x)|0;var F=O+I|0,K=C+P+getCarry(F,O)|0;h=u,b=m,u=s,m=p,s=a,p=d,a=o+q+getCarry(d=_+H|0,_)|0,o=n,_=l,n=i,l=c,i=r,c=f,r=q+K+getCarry(f=H+F|0,H)|0}this._al=this._al+f|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+_|0,this._el=this._el+d|0,this._fl=this._fl+p|0,this._gl=this._gl+m|0,this._hl=this._hl+b|0,this._ah=this._ah+r+getCarry(this._al,f)|0,this._bh=this._bh+i+getCarry(this._bl,c)|0,this._ch=this._ch+n+getCarry(this._cl,l)|0,this._dh=this._dh+o+getCarry(this._dl,_)|0,this._eh=this._eh+a+getCarry(this._el,d)|0,this._fh=this._fh+s+getCarry(this._fl,p)|0,this._gh=this._gh+u+getCarry(this._gl,m)|0,this._hh=this._hh+h+getCarry(this._hl,b)|0},Sha512.prototype._hash=function(){var t=__Buffer_364.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha512_364=Sha512;var _$sha384_363={},__Buffer_363=_$safeBuffer_345.Buffer,__W_363=new Array(160);function Sha384(){this.init(),this._w=__W_363,_$hash_357.call(this,128,112)}_$inherits_browser_317(Sha384,_$sha512_364),Sha384.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},Sha384.prototype._hash=function(){var t=__Buffer_363.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha384_363=Sha384;var _$shaJs_358={},exports=_$shaJs_358=function(t){t=t.toLowerCase();var e=exports[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};exports.sha=_$sha_359,exports.sha1=_$sha1_360,exports.sha224=_$sha224_361,exports.sha256=_$sha256_362,exports.sha384=_$sha384_363,exports.sha512=_$sha512_364;var _$inherits_browser_530={};_$inherits_browser_530="function"==typeof Object.create?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var _$processNextickArgs_549={};(function(t){"use strict";_$processNextickArgs_549=void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?{nextTick:function(e,r,i,n){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,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(o=new Array(s-1),a=0;a0?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 __Buffer_566.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i=__Buffer_566.allocUnsafe(t>>>0),n=this.head,o=0;n;)e=i,r=o,n.data.copy(e,r),o+=n.data.length,n=n.next;return i},t}(),util&&util.inspect&&util.inspect.custom&&(_$BufferList_566.prototype[util.inspect.custom]=function(){var t=util.inspect({length:this.length});return this.constructor.name+" "+t});var _$destroy_567={destroy:function(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||_$processNextickArgs_549.nextTick(emitErrorNT,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(_$processNextickArgs_549.nextTick(emitErrorNT,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)}},_$browser_588={};(function(t){function e(e){try{if(!t.localStorage)return!1}catch(i){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}_$browser_588=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$Transform_564=__Transform_564,__Duplex_564=_$Duplex_561({}),__util_564=Object.create(_$util_462);function __afterTransform_564(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(o);t[r];){var f=e[t.charCodeAt(r)];if(255===f)return;for(var c=0,l=o-1;(0!==f||c>>0,h[l]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");n=c,r++}if(" "!==t[r]){for(var _=o-n;_!==o&&0===h[_];)_++;var d=_Buffer.allocUnsafe(i+(o-_));d.fill(0,0,i);for(var p=i;_!==o;)d[p++]=h[_++];return d}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=_Buffer.from(e)),!_Buffer.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,n=0,o=e.length;n!==o&&0===e[n];)n++,r++;for(var u=(o-n)*h+1>>>0,f=new Uint8Array(u);n!==o;){for(var c=e[n],l=0,_=u-1;(0!==c||l>>0,f[_]=c%a>>>0,c=c/a>>>0;if(0!==c)throw new Error("Non-zero carry");i=l,n++}for(var d=u-i;d!==u&&0===f[d];)d++;for(var p=s.repeat(r);d21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function fromBech32(t){var e=_$bech32_161.decode(t),r=_$bech32_161.fromWords(e.words.slice(1));return{version:e.words[0],prefix:e.prefix,data:__Buffer_40.from(r)}}function toBase58Check(t,e){_$typeforce_388(_$types_78.tuple(_$types_78.Hash160bit,_$types_78.UInt8),arguments);var r=__Buffer_40.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),_$bs58check_210.encode(r)}function toBech32(t,e,r){var i=_$bech32_161.toWords(t);return i.unshift(e),_$bech32_161.encode(r,i)}var _$address_40={fromBase58Check:fromBase58Check,fromBech32:fromBech32,fromOutputScript:function(t,e){if(e=e||_$networks_49.bitcoin,_$templates_54.pubKeyHash.output.check(t))return toBase58Check(_$script_52.compile(t).slice(3,23),e.pubKeyHash);if(_$templates_54.scriptHash.output.check(t))return toBase58Check(_$script_52.compile(t).slice(2,22),e.scriptHash);if(_$templates_54.witnessPubKeyHash.output.check(t))return toBech32(_$script_52.compile(t).slice(2,22),0,e.bech32);if(_$templates_54.witnessScriptHash.output.check(t))return toBech32(_$script_52.compile(t).slice(2,34),0,e.bech32);throw new Error(_$script_52.toASM(t)+" has no matching Address")},toBase58Check:toBase58Check,toBech32:toBech32,toOutputScript:function(t,e){var r;e=e||_$networks_49.bitcoin;try{r=fromBase58Check(t)}catch(i){}if(r){if(r.version===e.pubKeyHash)return _$templates_54.pubKeyHash.output.encode(r.hash);if(r.version===e.scriptHash)return _$templates_54.scriptHash.output.encode(r.hash)}else{try{r=fromBech32(t)}catch(i){}if(r){if(r.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return _$templates_54.witnessPubKeyHash.output.encode(r.data);if(32===r.data.length)return _$templates_54.witnessScriptHash.output.encode(r.data)}}}throw new Error(t+" has no matching Script")}};function ripemd160(t){return _$browser_224("rmd160").update(t).digest()}function sha256(t){return _$browser_224("sha256").update(t).digest()}var _$crypto_43={hash160:function(t){return ripemd160(sha256(t))},hash256:function(t){return sha256(sha256(t))},ripemd160:ripemd160,sha1:function(t){return _$browser_224("sha1").update(t).digest()},sha256:sha256},_$package_167={version:"1.4.2"},_$bigi_164={};function BigInteger(t,e,r){if(!(this instanceof BigInteger))return new BigInteger(t,e,r);null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}var proto=BigInteger.prototype;proto.__bigi=_$package_167.version,BigInteger.isBigInteger=function(t,e){return t&&t.__bigi&&(!e||t.__bigi===proto.__bigi)},BigInteger.prototype.am=function(t,e,r,i,n,o){for(;--o>=0;){var a=e*this[t++]+r[i]+n;n=Math.floor(a/67108864),r[i++]=67108863&a}return n},BigInteger.prototype.DB=26,BigInteger.prototype.DM=67108863;var DV=BigInteger.prototype.DV=1<<26;BigInteger.prototype.FV=Math.pow(2,52),BigInteger.prototype.F1=26,BigInteger.prototype.F2=0;var rr,vv,BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array;for(rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){var r=BI_RC[t.charCodeAt(e)];return null==r?-1:r}function nbv(t){var e=new BigInteger;return e.fromInt(t),e}function nbits(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function Classic(t){this.m=t}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function cbit(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function NullExp(){}function nNop(t){return t}function Barrett(t){this.r2=new BigInteger,this.q3=new BigInteger,BigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}Classic.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},Classic.prototype.revert=function(t){return t},Classic.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},Classic.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Classic.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},Montgomery.prototype.convert=function(t){var e=new BigInteger;return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(BigInteger.ZERO)>0&&this.m.subTo(e,e),e},Montgomery.prototype.revert=function(t){var e=new BigInteger;return t.copyTo(e),this.reduce(e),e},Montgomery.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},Montgomery.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Montgomery.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},proto.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},proto.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0},proto.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var a=8==r?255&t[i]:intAt(t,i);a<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-o):this[this.t-1]|=a<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},proto.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},proto.drShiftTo=function(t,e){for(var r=t;r=0;--r)e[r+a+1]=this[r]>>n|s,s=(this[r]&o)<=0;--r)e[r]=0;e[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},proto.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<>i;for(var a=r+1;a>i;i>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()},proto.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},proto.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(u,o),n.lShiftTo(u,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,f=o[h-1];if(0!=f){var c=f*(1<1?o[h-2]>>this.F2:0),l=this.FV/c,_=(1<=0&&(r[r.t++]=1,r.subTo(b,r)),BigInteger.ONE.dlShiftTo(h,b),b.subTo(o,o);o.t=0;){var g=r[--p]==f?this.DM:Math.floor(r[p]*l+(r[p-1]+d)*_);if((r[p]+=o.am(0,g,r,m,0,h))0&&r.rShiftTo(u,r),a<0&&BigInteger.ZERO.subTo(r,r)}}},proto.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},proto.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},proto.exp=function(t,e){if(t>4294967295||t<1)return BigInteger.ONE;var r=new BigInteger,i=new BigInteger,n=e.convert(this),o=nbits(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var a=r;r=i,i=a}return e.revert(r)},proto.toString=function(t){var e;if(this.s<0)return"-"+this.negate().toString(t);if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(s>s)>0&&(n=!0,o=int2char(r));a>=0;)s>(s+=this.DB-e)):(r=this[a]>>(s-=e)&i,s<=0&&(s+=this.DB,--a)),r>0&&(n=!0),n&&(o+=int2char(r));return n?o:"0"},proto.negate=function(){var t=new BigInteger;return BigInteger.ZERO.subTo(this,t),t},proto.abs=function(){return this.s<0?this.negate():this},proto.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},proto.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)},proto.byteLength=function(){return this.bitLength()>>3},proto.mod=function(t){var e=new BigInteger;return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(BigInteger.ZERO)>0&&t.subTo(e,e),e},proto.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new Classic(e):new Montgomery(e),this.exp(t,r)},NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},NullExp.prototype.sqrTo=function(t,e){t.squareTo(e)},Barrett.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=new BigInteger;return t.copyTo(e),this.reduce(e),e},Barrett.prototype.revert=function(t){return t},Barrett.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},Barrett.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Barrett.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];proto.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},proto.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=nbv(r),n=new BigInteger,o=new BigInteger,a="";for(this.divRemTo(i,n,o);n.signum()>0;)a=(r+o.intValue()).toString(t).substr(1)+a,n.divRemTo(i,n,o);return o.intValue().toString(t)+a},proto.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,a=0,s=0;s=r&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(a,0)),n&&BigInteger.ZERO.subTo(this,this)},proto.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()},proto.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},proto.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},proto.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n=0;)r[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r},proto.millerRabin=function(t){var e=this.subtract(BigInteger.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);(t=t+1>>1)>lowprimes.length&&(t=lowprimes.length);for(var n=new BigInteger(null),o=[],a=0;a>24},proto.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},proto.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},proto.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this[t]&(1<>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0===n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},proto.equals=function(t){return 0==this.compareTo(t)},proto.min=function(t){return this.compareTo(t)<0?this:t},proto.max=function(t){return this.compareTo(t)>0?this:t},proto.and=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_and,e),e},proto.or=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_or,e),e},proto.xor=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_xor,e),e},proto.andNot=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_andnot,e),e},proto.not=function(){for(var t=new BigInteger,e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var f=new BigInteger;for(i.sqrTo(a[1],f);s<=h;)a[s]=new BigInteger,i.mulTo(f,a[s-2],a[s]),s+=2}var c,l,_=t.t-1,d=!0,p=new BigInteger;for(n=nbits(t[_])-1;_>=0;){for(n>=u?c=t[_]>>n-u&h:(c=(t[_]&(1<0&&(c|=t[_-1]>>this.DB+n-u)),s=r;0==(1&c);)c>>=1,--s;if((n-=s)<0&&(n+=this.DB,--_),d)a[c].copyTo(o),d=!1;else{for(;s>1;)i.sqrTo(o,p),i.sqrTo(p,o),s-=2;s>0?i.sqrTo(o,p):(l=o,o=p,p=l),i.mulTo(p,a[c],o)}for(;_>=0&&0==(t[_]&1<=0?(r.subTo(i,r),e&&n.subTo(a,n),o.subTo(s,o)):(i.subTo(r,i),e&&a.subTo(n,a),s.subTo(o,s))}if(0!=i.compareTo(BigInteger.ONE))return BigInteger.ZERO;for(;s.compareTo(t)>=0;)s.subTo(t,s);for(;s.signum()<0;)s.addTo(t,s);return s},proto.pow=function(t){return this.exp(t,new NullExp)},proto.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},proto.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=lowprimes[lowprimes.length-1]){for(e=0;e=4)throw new Error("Invalid hashType "+r);return{signature:e.fromDER(t.slice(0,-1)),hashType:r}},e.prototype.toCompact=function(e,r){r&&(e+=4),e+=27;var i=t.alloc(65);return i.writeUInt8(e,0),this.toRSBuffer(i,1),i},e.prototype.toDER=function(){var e=t.from(this.r.toDERInteger()),r=t.from(this.s.toDERInteger());return _$bip66_187.encode(e,r)},e.prototype.toRSBuffer=function(e,r){return r||(r=0),e=e||t.alloc(64),this.r.toBuffer(32).copy(e,r),this.s.toBuffer(32).copy(e,r+32),e},e.prototype.toScriptSignature=function(r,i){i||(i=e.ECDSA);var n=-193&r;if(n<=0||n>=4)throw new Error("Invalid hashType "+r);var o=t.alloc(1);if(o.writeUInt8(r,0),i===e.ECDSA)return t.concat([this.toDER(),o]);if(i===e.SCHNORR)return t.concat([this.toRSBuffer(),o]);throw new Error("Invalid signature Algorithm")},_$ecsignature_46=e}).call(this,_$buffer_460({}).Buffer);var _$point_270={},__Buffer_270=_$safeBuffer_345.Buffer,THREE=_$lib_166.valueOf(3);function Point(t,e,r,i){this.curve=t,this.x=e,this.y=r,this.z=i,this._zInv=null,this.compressed=!0}Object.defineProperty(Point.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInverse(this.curve.p)),this._zInv}}),Object.defineProperty(Point.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(Point.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),Point.fromAffine=function(t,e,r){return new Point(t,e,r,_$lib_166.ONE)},Point.prototype.equals=function(t){return t===this||(this.curve.isInfinity(this)?this.curve.isInfinity(t):this.curve.isInfinity(t)?this.curve.isInfinity(this):0===t.y.multiply(this.z).subtract(this.y.multiply(t.z)).mod(this.curve.p).signum()&&0===t.x.multiply(this.z).subtract(this.x.multiply(t.z)).mod(this.curve.p).signum())},Point.prototype.negate=function(){var t=this.curve.p.subtract(this.y);return new Point(this.curve,this.x,t,this.z)},Point.prototype.add=function(t){if(this.curve.isInfinity(this))return t;if(this.curve.isInfinity(t))return this;var e=this.x,r=this.y,i=t.x,n=t.y.multiply(this.z).subtract(r.multiply(t.z)).mod(this.curve.p),o=i.multiply(this.z).subtract(e.multiply(t.z)).mod(this.curve.p);if(0===o.signum())return 0===n.signum()?this.twice():this.curve.infinity;var a=o.square(),s=a.multiply(o),u=e.multiply(a),h=n.square().multiply(this.z),f=h.subtract(u.shiftLeft(1)).multiply(t.z).subtract(s).multiply(o).mod(this.curve.p),c=u.multiply(THREE).multiply(n).subtract(r.multiply(s)).subtract(h.multiply(n)).multiply(t.z).add(n.multiply(s)).mod(this.curve.p),l=s.multiply(this.z).multiply(t.z).mod(this.curve.p);return new Point(this.curve,f,c,l)},Point.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.signum())return this.curve.infinity;var t=this.x,e=this.y,r=e.multiply(this.z).mod(this.curve.p),i=r.multiply(e).mod(this.curve.p),n=this.curve.a,o=t.square().multiply(THREE);0!==n.signum()&&(o=o.add(this.z.square().multiply(n)));var a=(o=o.mod(this.curve.p)).square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(r).mod(this.curve.p),s=o.multiply(THREE).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(o.pow(3)).mod(this.curve.p),u=r.pow(3).shiftLeft(3).mod(this.curve.p);return new Point(this.curve,a,s,u)},Point.prototype.multiply=function(t){if(this.curve.isInfinity(this))return this;if(0===t.signum())return this.curve.infinity;for(var e=t,r=e.multiply(THREE),i=this.negate(),n=this,o=r.bitLength()-2;o>0;--o){var a=r.testBit(o),s=e.testBit(o);n=n.twice(),a!==s&&(n=n.add(a?this:i))}return n},Point.prototype.multiplyTwo=function(t,e,r){for(var i=Math.max(t.bitLength(),r.bitLength())-1,n=this.curve.infinity,o=this.add(e);i>=0;){var a=t.testBit(i),s=r.testBit(i);n=n.twice(),a?n=s?n.add(o):n.add(this):s&&(n=n.add(e)),--i}return n},Point.prototype.getEncoded=function(t){if(null==t&&(t=this.compressed),this.curve.isInfinity(this))return __Buffer_270.alloc(1,0);var e,r=this.affineX,i=this.affineY,n=this.curve.pLength;return t?(e=__Buffer_270.allocUnsafe(1+n)).writeUInt8(i.isEven()?2:3,0):((e=__Buffer_270.allocUnsafe(1+n+n)).writeUInt8(4,0),i.toBuffer(n).copy(e,1+n)),r.toBuffer(n).copy(e,1),e},Point.decodeFrom=function(t,e){var r,i=e.readUInt8(0),n=4!==i,o=Math.floor((t.p.bitLength()+7)/8),a=_$lib_166.fromBuffer(e.slice(1,1+o));if(n){var s=3===i;r=t.pointFromX(s,a)}else{var u=_$lib_166.fromBuffer(e.slice(1+o));r=Point.fromAffine(t,a,u)}return r.compressed=n,r},Point.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"},_$point_270=Point;var _$curve_266={};function Curve(t,e,r,i,n,o,a){this.p=t,this.a=e,this.b=r,this.G=_$point_270.fromAffine(this,i,n),this.n=o,this.h=a,this.infinity=new _$point_270(this,null,null,_$lib_166.ZERO),this.pOverFour=t.add(_$lib_166.ONE).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}Curve.prototype.pointFromX=function(t,e){var r=e.pow(3).add(this.a.multiply(e)).add(this.b).mod(this.p).modPow(this.pOverFour,this.p),i=r;return r.isEven()^!t&&(i=this.p.subtract(i)),_$point_270.fromAffine(this,e,i)},Curve.prototype.isInfinity=function(t){return t===this.infinity||0===t.z.signum()&&0!==t.y.signum()},Curve.prototype.isOnCurve=function(t){if(this.isInfinity(t))return!0;var e=t.affineX,r=t.affineY,i=this.a,n=this.b,o=this.p;if(e.signum()<0||e.compareTo(o)>=0)return!1;if(r.signum()<0||r.compareTo(o)>=0)return!1;var a=r.square().mod(o),s=e.pow(3).add(i.multiply(e)).add(n).mod(o);return a.equals(s)},Curve.prototype.validate=function(t){return t.multiply(this.n),!0},_$curve_266=Curve;var _$curves_267={secp128r1:{p:"fffffffdffffffffffffffffffffffff",a:"fffffffdfffffffffffffffffffffffc",b:"e87579c11079f43dd824993c2cee5ed3",n:"fffffffe0000000075a30d1b9038a115",h:"01",Gx:"161ff7528b899b2d0c28607ca52c5b86",Gy:"cf5ac8395bafeb13c02da292dded7a83"},secp160k1:{p:"fffffffffffffffffffffffffffffffeffffac73",a:"00",b:"07",n:"0100000000000000000001b8fa16dfab9aca16b6b3",h:"01",Gx:"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",Gy:"938cf935318fdced6bc28286531733c3f03c4fee"},secp160r1:{p:"ffffffffffffffffffffffffffffffff7fffffff",a:"ffffffffffffffffffffffffffffffff7ffffffc",b:"1c97befc54bd7a8b65acf89f81d4d4adc565fa45",n:"0100000000000000000001f4c8f927aed3ca752257",h:"01",Gx:"4a96b5688ef573284664698968c38bb913cbfc82",Gy:"23a628553168947d59dcc912042351377ac5fb32"},secp192k1:{p:"fffffffffffffffffffffffffffffffffffffffeffffee37",a:"00",b:"03",n:"fffffffffffffffffffffffe26f2fc170f69466a74defd8d",h:"01",Gx:"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",Gy:"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"},secp192r1:{p:"fffffffffffffffffffffffffffffffeffffffffffffffff",a:"fffffffffffffffffffffffffffffffefffffffffffffffc",b:"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",n:"ffffffffffffffffffffffff99def836146bc9b1b4d22831",h:"01",Gx:"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",Gy:"07192b95ffc8da78631011ed6b24cdd573f977a11e794811"},secp256k1:{p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"},secp256r1:{p:"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",a:"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",b:"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",n:"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",h:"01",Gx:"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",Gy:"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"}},_$names_269=function(t){var e=_$curves_267[t];if(!e)return null;var r=new _$lib_166(e.p,16),i=new _$lib_166(e.a,16),n=new _$lib_166(e.b,16),o=new _$lib_166(e.n,16),a=new _$lib_166(e.h,16),s=new _$lib_166(e.Gx,16),u=new _$lib_166(e.Gy,16);return new _$curve_266(r,i,n,s,u,o,a)},_$lib_268={Point:_$point_270,getCurveByName:_$names_269},_$legacy_227={},__Buffer_227=_$safeBuffer_345.Buffer,ZEROS=__Buffer_227.alloc(128),blocksize=64;function Hmac(t,e){_$cipherBase_223.call(this,"digest"),"string"==typeof e&&(e=__Buffer_227.from(e)),this._alg=t,this._key=e,e.length>blocksize?e=t(e):e.lengthr?e=("rmd160"===t?new _$ripemd160_344:_$shaJs_358(t)).update(e).digest():e.length=0||!r(a);)n=_$browser_226("sha256",n).update(o).update(ZERO).digest(),o=_$browser_226("sha256",n).update(o).digest(),o=_$browser_226("sha256",n).update(o).digest(),a=_$lib_166.fromBuffer(o);return a}},__secp256k1_44=_$lib_268.getCurveByName("secp256k1"),deterministicGenerateK=_$rfc6979_50.deterministicGenerateK,N_OVER_TWO=__secp256k1_44.n.shiftRight(1),_$ecdsa_44={sign:function(t,e){_$typeforce_388(_$types_78.tuple(_$types_78.Hash256bit,_$types_78.BigInt),arguments);var r,i,n=e.toBuffer(32),o=_$lib_166.fromBuffer(t),a=__secp256k1_44.n,s=__secp256k1_44.G;return deterministicGenerateK(t,n,(function(t){var n=s.multiply(t);return!__secp256k1_44.isInfinity(n)&&0!==(r=n.affineX.mod(a)).signum()&&0!==(i=t.modInverse(a).multiply(o.add(e.multiply(r))).mod(a)).signum()})),i.compareTo(N_OVER_TWO)>0&&(i=a.subtract(i)),new _$ecsignature_46(r,i)},verify:function(t,e,r){_$typeforce_388(_$types_78.tuple(_$types_78.Hash256bit,_$types_78.ECSignature,_$types_78.ECPoint),arguments);var i=__secp256k1_44.n,n=__secp256k1_44.G,o=e.r,a=e.s;if(o.signum()<=0||o.compareTo(i)>=0)return!1;if(a.signum()<=0||a.compareTo(i)>=0)return!1;var s=_$lib_166.fromBuffer(t),u=a.modInverse(i),h=s.multiply(u).mod(i),f=o.multiply(u).mod(i),c=n.multiplyTwo(h,r,f);return!__secp256k1_44.isInfinity(c)&&c.affineX.mod(i).equals(o)},__curve:__secp256k1_44},_$schnorr_51={};(function(t){var e=_$lib_268.getCurveByName("secp256k1"),r=_$rfc6979_50.deterministicGenerateK;function i(t,e){return t.modPow(e.subtract(_$lib_166.ONE).divide(_$lib_166.valueOf(2)),e).intValue()}function n(e){return _$typeforce_388(_$types_78.tuple(_$types_78.ECPoint),arguments),t.concat([t.from([e.affineY.isEven()?2:3]),e.affineX.toBuffer(32)])}_$schnorr_51={sign:function(o,a){_$typeforce_388(_$types_78.tuple(_$types_78.BufferN(32),_$types_78.BigInt),arguments);var s=e.n,u=e.G;if(a.compareTo(_$lib_166.ZERO)<=0||a.compareTo(s)>=0)throw new Error("Private key x not in range");var h,f,c=u.multiply(a);function l(r){var l=u.multiply(r);1!=i(l.affineY,e.p)&&(r=s.subtract(r),l=u.multiply(r)),h=l.affineX.mod(s);var _=n(c),d=h.toBuffer(32),p=_$crypto_43.sha256(t.concat([d,_,o])),m=_$lib_166.fromBuffer(p).mod(s);return f=r.add(m.multiply(a)).mod(s),!0}return r(o,a.toBuffer(32),l,t.from("Schnorr+SHA256 ","ascii")),new _$ecsignature_46(h,f)}}}).call(this,_$buffer_460({}).Buffer);var _$browser_342={};(function(t,e){"use strict";var r=_$safeBuffer_345.Buffer,i=e.crypto||e.msCrypto;_$browser_342=i&&i.getRandomValues?function(e,n){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a=0)throw new Error("Private key must be less than the curve order");if(e)throw new TypeError("Unexpected publicKey parameter");this.d=t}else _$typeforce_388(_$types_78.ECPoint,e),this.__Q=e;this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||_$networks_49.bitcoin}Object.defineProperty(ECPair.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=__secp256k1_45.G.multiply(this.d)),this.__Q}}),ECPair.fromPublicKeyBuffer=function(t,e){var r=_$lib_268.Point.decodeFrom(__secp256k1_45,t);return new ECPair(null,r,{compressed:r.compressed,network:e})},ECPair.fromWIF=function(t,e){var r=_$wif_393.decode(t),i=r.version;if(_$types_78.Array(e)){if(!(e=e.filter((function(t){return i===t.wif})).pop()))throw new Error("Unknown network version")}else if(e=e||_$networks_49.bitcoin,i!==e.wif)throw new Error("Invalid network version");return new ECPair(_$lib_166.fromBuffer(r.privateKey),null,{compressed:r.compressed,network:e})},ECPair.makeRandom=function(t){var e,r=(t=t||{}).rng||_$browser_342;do{var i=r(32);_$typeforce_388(_$types_78.Buffer256bit,i),e=_$lib_166.fromBuffer(i)}while(e.signum()<=0||e.compareTo(__secp256k1_45.n)>=0);return new ECPair(e,null,t)},ECPair.prototype.getAddress=function(){return _$address_40.toBase58Check(_$crypto_43.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},ECPair.prototype.getNetwork=function(){return this.network},ECPair.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},ECPair.prototype.sign=function(t,e){if(!this.d)throw new Error("Missing private key");return e||(e=_$ecsignature_46.ECDSA),e===_$ecsignature_46.ECDSA?_$ecdsa_44.sign(t,this.d):e===_$ecsignature_46.SCHNORR?_$schnorr_51.sign(t,this.d):void 0},ECPair.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return _$wif_393.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},ECPair.prototype.verify=function(t,e){return _$ecdsa_44.verify(t,e,this.Q)},_$ecpair_45=ECPair;var _$hdnode_47={},__Buffer_47=_$safeBuffer_345.Buffer,curve=_$lib_268.getCurveByName("secp256k1");function HDNode(t,e){if(!t.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=t,this.chainCode=e,this.depth=0,this.index=0,this.parentFingerprint=0}HDNode.HIGHEST_BIT=2147483648,HDNode.LENGTH=78,HDNode.MASTER_SECRET=__Buffer_47.from("Bitcoin seed","utf8"),HDNode.fromSeedBuffer=function(t,e){if(_$typeforce_388(_$types_78.tuple(_$types_78.Buffer,_$types_78.maybe(_$types_78.Network)),arguments),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");var r=_$browser_226("sha512",HDNode.MASTER_SECRET).update(t).digest(),i=r.slice(0,32),n=r.slice(32),o=_$lib_166.fromBuffer(i);return new HDNode(new _$ecpair_45(o,null,{network:e}),n)},HDNode.fromSeedHex=function(t,e){return HDNode.fromSeedBuffer(__Buffer_47.from(t,"hex"),e)},HDNode.fromBase58=function(t,e){var r=_$bs58check_210.decode(t);if(78!==r.length)throw new Error("Invalid buffer length");var i,n=r.readUInt32BE(0);if(Array.isArray(e)){if(!(i=e.filter((function(t){return n===t.bip32.private||n===t.bip32.public})).pop()))throw new Error("Unknown network version")}else i=e||_$networks_49.bitcoin;if(n!==i.bip32.private&&n!==i.bip32.public)throw new Error("Invalid network version");var o=r[4],a=r.readUInt32BE(5);if(0===o&&0!==a)throw new Error("Invalid parent fingerprint");var s=r.readUInt32BE(9);if(0===o&&0!==s)throw new Error("Invalid index");var u,h=r.slice(13,45);if(n===i.bip32.private){if(0!==r.readUInt8(45))throw new Error("Invalid private key");var f=_$lib_166.fromBuffer(r.slice(46,78));u=new _$ecpair_45(f,null,{network:i})}else{var c=_$lib_268.Point.decodeFrom(curve,r.slice(45,78));curve.validate(c),u=new _$ecpair_45(null,c,{network:i})}var l=new HDNode(u,h);return l.depth=o,l.index=s,l.parentFingerprint=a,l},HDNode.prototype.getAddress=function(){return this.keyPair.getAddress()},HDNode.prototype.getIdentifier=function(){return _$crypto_43.hash160(this.keyPair.getPublicKeyBuffer())},HDNode.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},HDNode.prototype.getNetwork=function(){return this.keyPair.getNetwork()},HDNode.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},HDNode.prototype.neutered=function(){var t=new HDNode(new _$ecpair_45(null,this.keyPair.Q,{network:this.keyPair.network}),this.chainCode);return t.depth=this.depth,t.index=this.index,t.parentFingerprint=this.parentFingerprint,t},HDNode.prototype.sign=function(t){return this.keyPair.sign(t)},HDNode.prototype.verify=function(t,e){return this.keyPair.verify(t,e)},HDNode.prototype.toBase58=function(t){if(void 0!==t)throw new TypeError("Unsupported argument in 2.0.0");var e=this.keyPair.network,r=this.isNeutered()?e.bip32.public:e.bip32.private,i=__Buffer_47.allocUnsafe(78);return i.writeUInt32BE(r,0),i.writeUInt8(this.depth,4),i.writeUInt32BE(this.parentFingerprint,5),i.writeUInt32BE(this.index,9),this.chainCode.copy(i,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(i,45):(i.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(i,46)),_$bs58check_210.encode(i)},HDNode.prototype.derive=function(t){_$typeforce_388(_$types_78.UInt32,t);var e=t>=HDNode.HIGHEST_BIT,r=__Buffer_47.allocUnsafe(37);if(e){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");r[0]=0,this.keyPair.d.toBuffer(32).copy(r,1),r.writeUInt32BE(t,33)}else this.keyPair.getPublicKeyBuffer().copy(r,0),r.writeUInt32BE(t,33);var i,n=_$browser_226("sha512",this.chainCode).update(r).digest(),o=n.slice(0,32),a=n.slice(32),s=_$lib_166.fromBuffer(o);if(s.compareTo(curve.n)>=0)return this.derive(t+1);if(this.isNeutered()){var u=curve.G.multiply(s).add(this.keyPair.Q);if(curve.isInfinity(u))return this.derive(t+1);i=new _$ecpair_45(null,u,{network:this.keyPair.network})}else{var h=s.add(this.keyPair.d).mod(curve.n);if(0===h.signum())return this.derive(t+1);i=new _$ecpair_45(h,null,{network:this.keyPair.network})}var f=new HDNode(i,a);return f.depth=this.depth+1,f.index=t,f.parentFingerprint=this.getFingerprint().readUInt32BE(0),f},HDNode.prototype.deriveHardened=function(t){return _$typeforce_388(_$types_78.UInt31,t),this.derive(t+HDNode.HIGHEST_BIT)},HDNode.prototype.isNeutered=function(){return!this.keyPair.d},HDNode.prototype.derivePath=function(t){_$typeforce_388(_$types_78.BIP32Path,t);var e=t.split("/");if("m"===e[0]){if(this.parentFingerprint)throw new Error("Not a master node");e=e.slice(1)}return e.reduce((function(t,e){var r;return"'"===e.slice(-1)?(r=parseInt(e.slice(0,-1),10),t.deriveHardened(r)):(r=parseInt(e,10),t.derive(r))}),this)},_$hdnode_47=HDNode;var __Buffer_392=_$safeBuffer_345.Buffer,MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(t){if(t<0||t>MAX_SAFE_INTEGER||t%1!=0)throw new RangeError("value out of range")}function __encodingLength_392(t){return checkUInt53(t),t<253?1:t<=65535?3:t<=4294967295?5:9}var _$varuintBitcoin_392={encode:function t(e,r,i){if(checkUInt53(e),r||(r=__Buffer_392.allocUnsafe(__encodingLength_392(e))),!__Buffer_392.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),e<253?(r.writeUInt8(e,i),t.bytes=1):e<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(e,i+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(e,i+1),t.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(e>>>0,i+1),r.writeUInt32LE(e/4294967296|0,i+5),t.bytes=9),r},decode:function t(e,r){if(!__Buffer_392.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=e.readUInt8(r);if(i<253)return t.bytes=1,i;if(253===i)return t.bytes=3,e.readUInt16LE(r+1);if(254===i)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var n=e.readUInt32LE(r+1),o=4294967296*e.readUInt32LE(r+5)+n;return checkUInt53(o),o},encodingLength:__encodingLength_392};function verifuint(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}var _$bufferutils_42={pushDataSize:_$pushdataBitcoin_97.encodingLength,readPushDataInt:_$pushdataBitcoin_97.decode,readUInt64LE:function(t,e){var r=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return verifuint((i*=4294967296)+r,9007199254740991),i+r},readVarInt:function(t,e){return{number:_$varuintBitcoin_392.decode(t,e),size:_$varuintBitcoin_392.decode.bytes}},varIntBuffer:_$varuintBitcoin_392.encode,varIntSize:_$varuintBitcoin_392.encodingLength,writePushDataInt:_$pushdataBitcoin_97.encode,writeUInt64LE:function(t,e,r){return verifuint(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8},writeVarInt:function(t,e,r){return _$varuintBitcoin_392.encode(e,t,r),_$varuintBitcoin_392.encode.bytes}},_$transaction_76={},__Buffer_76=_$safeBuffer_345.Buffer;function varSliceSize(t){var e=t.length;return _$varuintBitcoin_392.encodingLength(e)+e}function Transaction(){this.version=2,this.locktime=0,this.ins=[],this.outs=[]}Transaction.DEFAULT_SEQUENCE=4294967295,Transaction.SIGHASH_ALL=1,Transaction.SIGHASH_NONE=2,Transaction.SIGHASH_SINGLE=3,Transaction.SIGHASH_ANYONECANPAY=128,Transaction.SIGHASH_BITCOINCASHBIP143=64,Transaction.ADVANCED_TRANSACTION_MARKER=0,Transaction.ADVANCED_TRANSACTION_FLAG=1;var EMPTY_SCRIPT=__Buffer_76.allocUnsafe(0),EMPTY_WITNESS=[],__ZERO_76=__Buffer_76.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),__ONE_76=__Buffer_76.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=__Buffer_76.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_SCRIPT,valueBuffer:VALUE_UINT64_MAX};Transaction.fromBuffer=function(t,e){var r=0;function i(e){return r+=e,t.slice(r-e,r)}function n(){var e=t.readUInt32LE(r);return r+=4,e}function o(){var e=_$bufferutils_42.readUInt64LE(t,r);return r+=8,e}function a(){var e=_$varuintBitcoin_392.decode(t,r);return r+=_$varuintBitcoin_392.decode.bytes,e}function s(){return i(a())}function u(){for(var t=a(),e=[],r=0;r=this.ins.length)return __ONE_76;var i=_$script_52.compile(_$script_52.decompile(e).filter((function(t){return t!==_$index_38.OP_CODESEPARATOR}))),n=this.clone();if((31&r)===Transaction.SIGHASH_NONE)n.outs=[],n.ins.forEach((function(e,r){r!==t&&(e.sequence=0)}));else if((31&r)===Transaction.SIGHASH_SINGLE){if(t>=this.outs.length)return __ONE_76;n.outs.length=t+1;for(var o=0;o0)return e=e.map((function(t){return t||_$index_38.OP_0})),i||(e=e.filter((function(t){return t!==_$index_38.OP_0}))),_$templates_54.multisig.input.encodeStack(e)}if(!i)throw new Error("Not enough signatures provided");return[]}function TransactionBuilder(t,e){this.prevTxMap={},this.network=t||_$networks_49.bitcoin,this.maximumFeeRate=e||2500,this.inputs=[],this.bitcoinCash=!0,this.tx=new _$transaction_76}function canSign(t){return void 0!==t.prevOutScript&&void 0!==t.signScript&&void 0!==t.pubKeys&&void 0!==t.signatures&&t.signatures.length===t.pubKeys.length&&t.pubKeys.length>0&&(!1===t.witness||!0===t.witness&&void 0!==t.value)}function signatureHashType(t){return t.readUInt8(t.length-1)}TransactionBuilder.prototype.setLockTime=function(t){if(_$typeforce_388(_$types_78.UInt32,t),this.inputs.some((function(t){return!!t.signatures&&t.signatures.some((function(t){return t}))})))throw new Error("No, this would invalidate signatures");this.tx.locktime=t},TransactionBuilder.fromTransaction=function(t,e,r){var i=new TransactionBuilder(e);return i.setLockTime(t.locktime),t.outs.forEach((function(t){i.addOutput(t.script,t.value)})),t.ins.forEach((function(t){i.__addInputUnsafe(t.hash,t.index,{sequence:t.sequence,script:t.script,witness:t.witness,value:t.value})})),i.inputs.forEach((function(e,i){!function(t,e,r,i,n){if(t.redeemScriptType===scriptTypes.MULTISIG&&t.redeemScript&&t.pubKeys.length!==t.signatures.length){var o=t.signatures.concat();t.signatures=t.pubKeys.map((function(a){var s,u=_$ecpair_45.fromPublicKeyBuffer(a);return o.some((function(a,h){if(!a)return!1;var f,c=_$ecsignature_46.parseScriptSignature(a);return f=n?e.hashForCashSignature(r,t.signScript,i,c.hashType):t.witness?e.hashForWitnessV0(r,t.signScript,i,c.hashType):e.hashForSignature(r,t.signScript,c.hashType),!!u.verify(f,c.signature)&&(o[h]=void 0,s=a,!0)})),s}))}}(e,t,i,e.value,r)})),i},TransactionBuilder.prototype.addInput=function(t,e,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var n;if("string"==typeof t)t=__Buffer_77.from(t,"hex").reverse();else if(t instanceof _$transaction_76){var o=t.outs[e];i=o.script,n=o.value,t=t.getHash()}return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:n})},TransactionBuilder.prototype.__addInputUnsafe=function(t,e,r){if(_$transaction_76.isCoinbaseHash(t))throw new Error("coinbase inputs not supported");var i=t.toString("hex")+":"+e;if(void 0!==this.prevTxMap[i])throw new Error("Duplicate TxOut: "+i);var n={};if(void 0!==r.script&&(n=expandInput(r.script,r.witness||[])),void 0!==r.value&&(n.value=r.value),!n.prevOutScript&&r.prevOutScript){var o;if(!n.pubKeys&&!n.signatures){var a=expandOutput(r.prevOutScript);a.pubKeys&&(n.pubKeys=a.pubKeys,n.signatures=a.signatures),o=a.scriptType}n.prevOutScript=r.prevOutScript,n.prevOutType=o||_$templates_54.classifyOutput(r.prevOutScript)}var s=this.tx.addInput(t,e,r.sequence,r.scriptSig);return this.inputs[s]=n,this.prevTxMap[i]=s,s},TransactionBuilder.prototype.addOutput=function(t,e){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof t&&(t=_$address_40.toOutputScript(t,this.network)),this.tx.addOutput(t,e)},TransactionBuilder.prototype.build=function(){return this.__build(!1)},TransactionBuilder.prototype.buildIncomplete=function(){return this.__build(!0)},TransactionBuilder.prototype.__build=function(t){if(!t){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var e=this.tx.clone();if(this.inputs.forEach((function(r,i){if(!(r.witnessScriptType||r.redeemScriptType||r.prevOutType||t))throw new Error("Transaction is not complete");var n=function(t,e){var r=t.prevOutType,i=[],n=[];supportedType(r)&&(i=buildStack(r,t.signatures,t.pubKeys,e));var o=!1;if(r===_$templates_54.types.P2SH){if(!e&&!supportedP2SHType(t.redeemScriptType))throw new Error("Impossible to sign this type");supportedType(t.redeemScriptType)&&(i=buildStack(t.redeemScriptType,t.signatures,t.pubKeys,e)),t.redeemScriptType&&(o=!0,r=t.redeemScriptType)}switch(r){case _$templates_54.types.P2WPKH:n=buildStack(_$templates_54.types.P2PKH,t.signatures,t.pubKeys,e);break;case _$templates_54.types.P2WSH:if(!e&&!supportedType(t.witnessScriptType))throw new Error("Impossible to sign this type");supportedType(t.witnessScriptType)&&((n=buildStack(t.witnessScriptType,t.signatures,t.pubKeys,e)).push(t.witnessScript),r=t.witnessScriptType)}return o&&i.push(t.redeemScript),{type:r,script:_$script_52.compile(i),witness:n}}(r,t);if(!t&&!supportedType(n.type)&&n.type!==_$templates_54.types.P2WPKH)throw new Error(n.type+" not supported");e.setInputScript(i,n.script),e.setWitness(i,n.witness)})),!t&&this.__overMaximumFees(e.virtualSize()))throw new Error("Transaction has absurd fees");return e},TransactionBuilder.prototype.sign=function(t,e,r,i,n,o,a){if(i|=_$transaction_76.SIGHASH_BITCOINCASHBIP143,!this.inputs[t])throw new Error("No input at index: "+t);i=i||_$transaction_76.SIGHASH_ALL;var s=this.inputs[t];if(void 0!==s.redeemScript&&r&&!s.redeemScript.equals(r))throw new Error("Inconsistent redeemScript");var u=e.publicKey||e.getPublicKeyBuffer();if(!canSign(s)){if(void 0!==n){if(void 0!==s.value&&s.value!==n)throw new Error("Input didn't match witnessValue");_$typeforce_388(_$types_78.Satoshi,n),s.value=n}if(canSign(s)||prepareInput(s,u,r,0,o),!canSign(s))throw Error(s.prevOutType+" not supported")}var h=this.tx.hashForCashSignature(t,s.signScript,n,i);if(!s.pubKeys.some((function(t,r){if(!u.equals(t))return!1;if(s.signatures[r])throw new Error("Signature already exists");if(33!==u.length&&s.signType===scriptTypes.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");var n=e.sign(h,a);return __Buffer_77.isBuffer(n)&&(n=_$ecsignature_46.fromRSBuffer(n)),s.signatures[r]=n.toScriptSignature(i,a),!0})))throw new Error("Key pair cannot sign for this input")},TransactionBuilder.prototype.__canModifyInputs=function(){return this.inputs.every((function(t){return void 0===t.signatures||t.signatures.every((function(t){return!t||signatureHashType(t)&_$transaction_76.SIGHASH_ANYONECANPAY}))}))},TransactionBuilder.prototype.__canModifyOutputs=function(){var t=this.tx.ins.length,e=this.tx.outs.length;return this.inputs.every((function(r){return void 0===r.signatures||r.signatures.every((function(r){if(!r)return!0;var i=31&signatureHashType(r);return i===_$transaction_76.SIGHASH_NONE||(i===_$transaction_76.SIGHASH_SINGLE?t<=e:void 0)}))}))},TransactionBuilder.prototype.__overMaximumFees=function(t){return(this.inputs.reduce((function(t,e){return t+(e.value>>>0)}),0)-this.tx.outs.reduce((function(t,e){return t+e.value}),0))/t>this.maximumFeeRate},_$transaction_builder_77=TransactionBuilder;var _$fastRoot_322={};(function(t){_$fastRoot_322=function(e,r){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof r)throw TypeError("Expected digest Function");for(var i=e.length,n=e.concat();i>1;){for(var o=0,a=0;a>24)-3,r=8388607&t,i=__Buffer_41.alloc(32,0);return i.writeUInt32BE(r,28-e),i},Block.calculateMerkleRoot=function(t){if(_$typeforce_388([{getHash:_$types_78.Function}],t),0===t.length)throw TypeError("Cannot compute merkle root for zero transactions");var e=t.map((function(t){return t.getHash()}));return _$fastRoot_322(e,_$crypto_43.hash256)},Block.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var t=Block.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)},Block.prototype.checkProofOfWork=function(){var t=this.getHash().reverse(),e=Block.calculateTarget(this.bits);return t.compare(e)<=0},_$block_41=Block,_$templates_54)_$script_52[key]=_$templates_54[key];var _$src_48={ECPair:_$ecpair_45,ECSignature:_$ecsignature_46,HDNode:_$hdnode_47,TransactionBuilder:_$transaction_builder_77,address:_$address_40,crypto:_$crypto_43,networks:_$networks_49,script:_$script_52},_$big_163={exports:{}};!function(t){"use strict";var e,r={},i=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function n(t,e,r){var i=t.constructor,n=e-(t=new i(t)).e,a=t.c;for(a.length>++e&&o(t,n,i.RM),a[0]?r?n=e:(a=t.c,n=t.e+n+1):++n;a.length1?a[0]+"."+a.join("").slice(1):a[0])+(n<0?"e":"e+")+n:t.toString()}function o(t,e,r,i){var n,o=t.c,s=t.e+e+1;if(1===r?i=o[s]>=5:2===r?i=o[s]>5||5==o[s]&&(i||s<0||o[s+1]!==n||1&o[s-1]):3===r?i=i||o[s]!==n||s<0:(i=!1,0!==r&&a("!Big.RM!")),s<1||!o[0])i?(t.e=-e,t.c=[1]):t.c=[t.e=0];else{if(o.length=s--,i)for(;++o[s]>9;)o[s]=0,s--||(++t.e,o.unshift(1));for(s=o.length;!o[--s];o.pop());}return t}function a(t){var e=new Error(t);throw e.name="BigError",e}r.abs=function(){var t=new this.constructor(this);return t.s=1,t},r.cmp=function(t){var e,r=this,i=r.c,n=(t=new r.constructor(t)).c,o=r.s,a=t.s,s=r.e,u=t.e;if(!i[0]||!n[0])return i[0]?o:n[0]?-a:0;if(o!=a)return o;if(e=o<0,s!=u)return s>u^e?1:-1;for(o=-1,a=(s=i.length)<(u=n.length)?s:u;++on[o]^e?1:-1;return s==u?0:s>u^e?1:-1},r.div=function(t){var e=this,r=e.constructor,i=e.c,n=(t=new r(t)).c,s=e.s==t.s?1:-1,u=r.DP;if((u!==~~u||u<0||u>1e6)&&a("!Big.DP!"),!i[0]||!n[0])return i[0]==n[0]&&a(NaN),n[0]||a(s/0),new r(0*s);var h,f,c,l,_,d,p=n.slice(),m=h=n.length,b=i.length,g=i.slice(0,h),v=g.length,y=t,w=y.c=[],M=0,S=u+(y.e=e.e-t.e)+1;for(y.s=s,s=S<0?0:S,p.unshift(0);v++v?1:-1;else for(_=-1,l=0;++_g[_]?1:-1;break}if(!(l<0))break;for(f=v==h?n:p;v;){if(g[--v]S&&o(y,u,r.RM,g[0]!==d),y},r.eq=function(t){return!this.cmp(t)},r.gt=function(t){return this.cmp(t)>0},r.gte=function(t){return this.cmp(t)>-1},r.lt=function(t){return this.cmp(t)<0},r.lte=function(t){return this.cmp(t)<1},r.sub=r.minus=function(t){var e,r,i,n,o=this,a=o.constructor,s=o.s,u=(t=new a(t)).s;if(s!=u)return t.s=-u,o.plus(t);var h=o.c.slice(),f=o.e,c=t.c,l=t.e;if(!h[0]||!c[0])return c[0]?(t.s=-u,t):new a(h[0]?o:0);if(s=f-l){for((n=s<0)?(s=-s,i=h):(l=f,i=c),i.reverse(),u=s;u--;i.push(0));i.reverse()}else for(r=((n=h.length0)for(;u--;h[e++]=0);for(u=e;r>s;){if(h[--r]0?(u=a,e=h):(n=-n,e=s),e.reverse();n--;e.push(0));e.reverse()}for(s.length-h.length<0&&(e=h,h=s,s=e),n=h.length,o=0;n;)o=(s[--n]=s[n]+h[n]+o)/10|0,s[n]%=10;for(o&&(s.unshift(o),++u),n=s.length;0===s[--n];s.pop());return t.c=s,t.e=u,t},r.pow=function(t){var e=this,r=new e.constructor(1),i=r,n=t<0;for((t!==~~t||t<-1e6||t>1e6)&&a("!pow!"),t=n?-t:t;1&t&&(i=i.times(e)),t>>=1;)e=e.times(e);return n?r.div(i):i},r.round=function(t,e){var r=this,i=r.constructor;return null==t?t=0:(t!==~~t||t<0||t>1e6)&&a("!round!"),o(r=new i(r),t,null==e?i.RM:e),r},r.sqrt=function(){var t,e,r,i=this,n=i.constructor,s=i.c,u=i.s,h=i.e,f=new n("0.5");if(!s[0])return new n(i);u<0&&a(NaN),0===(u=Math.sqrt(i.toString()))||u===1/0?((t=s.join("")).length+h&1||(t+="0"),(e=new n(Math.sqrt(t).toString())).e=((h+1)/2|0)-(h<0||1&h)):e=new n(u.toString()),u=e.e+(n.DP+=4);do{r=e,e=f.times(r.plus(i.div(r)))}while(r.c.slice(0,u).join("")!==e.c.slice(0,u).join(""));return o(e,n.DP-=4,n.RM),e},r.mul=r.times=function(t){var e,r=this,i=r.constructor,n=r.c,o=(t=new i(t)).c,a=n.length,s=o.length,u=r.e,h=t.e;if(t.s=r.s==t.s?1:-1,!n[0]||!o[0])return new i(0*t.s);for(t.e=u+h,au;)s=e[h]+o[u]*n[h-u-1]+s,e[h--]=s%10,s=s/10|0;e[h]=(e[h]+s)%10}for(s&&++t.e,e[0]||e.shift(),u=e.length;!e[--u];e.pop());return t.c=e,t},r.toString=r.valueOf=r.toJSON=function(){var t=this,e=t.constructor,r=t.e,i=t.c.join(""),n=i.length;if(r<=e.E_NEG||r>=e.E_POS)i=i.charAt(0)+(n>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;i="0"+i);i="0."+i}else if(r>0)if(++r>n)for(r-=n;r--;i+="0");else r1&&(i=i.charAt(0)+"."+i.slice(1));return t.s<0&&t.c[0]?"-"+i:i},r.toExponential=function(t){return null==t?t=this.c.length-1:(t!==~~t||t<0||t>1e6)&&a("!toExp!"),n(this,t,1)},r.toFixed=function(t){var e,r=this,i=r.constructor,o=i.E_NEG,s=i.E_POS;return i.E_NEG=-(i.E_POS=1/0),null==t?e=r.toString():t===~~t&&t>=0&&t<=1e6&&(e=n(r,r.e+t),r.s<0&&r.c[0]&&e.indexOf("-")<0&&(e="-"+e)),i.E_NEG=o,i.E_POS=s,e||a("!toFix!"),e},r.toPrecision=function(t){return null==t?this.toString():((t!==~~t||t<1||t>1e6)&&a("!toPre!"),n(this,t-1,2))},e=function t(){function e(r){var n=this;if(!(n instanceof e))return void 0===r?t():new e(r);r instanceof e?(n.s=r.s,n.e=r.e,n.c=r.c.slice()):function(t,e){var r,n,o;for(0===e&&1/e<0?e="-0":i.test(e+="")||a(NaN),t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[];n<=o;t.c.push(+e.charAt(n++)));}}(n,r),n.constructor=e}return e.prototype=r,e.DP=20,e.RM=1,e.E_NEG=-7,e.E_POS=21,e}(),"function"==typeof define&&define.amd?define((function(){return e})):_$big_163.exports?(_$big_163.exports=e,_$big_163.exports.Big=e):t.Big=e}(this),_$big_163=_$big_163.exports;var _$satoshiBitcoin_346={};function toNumber(t){return Number(t)}Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&t%1==0}),_$satoshiBitcoin_346={toBitcoin:function(t){var e=typeof t;if("string"===e&&(t=toNumber(t),e="number"),"number"!==e)throw new TypeError("toBitcoin must be called on a number or string, got "+e);if(!Number.isInteger(t))throw new TypeError("toBitcoin must be called on a whole number or string format whole number");var r=new _$big_163(t);return Number(r.div(1e8))},toSatoshi:function(t){var e=typeof t;if("string"===e&&(t=toNumber(t),e="number"),"number"!==e)throw new TypeError("toSatoshi must be called on a number or string, got "+e);var r=new _$big_163(t);return Number(r.times(1e8))}};var _$bufferEquals_211={};(function(t){"use strict";_$bufferEquals_211=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return!0;if("function"==typeof e.equals)return e.equals(r);if(e.length!==r.length)return!1;for(var i=0;i=r)throw RangeError(i)}}).call(this,{isBuffer:_$isBuffer_531});var _$der_353={},__Buffer_353=_$safeBuffer_345.Buffer,EC_PRIVKEY_EXPORT_DER_COMPRESSED=__Buffer_353.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]),EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=__Buffer_353.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]);_$der_353.privateKeyExport=function(t,e,r){var i=__Buffer_353.from(r?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);return t.copy(i,r?8:9),e.copy(i,r?181:214),i},_$der_353.privateKeyImport=function(t){var e=t.length,r=0;if(!(e2||e1?t[r+i-2]<<8:0);if(!(e<(r+=i)+n||e32||e1&&0===e[i]&&!(128&e[i+1]);--r,++i);for(var n=__Buffer_353.concat([__Buffer_353.from([0]),t.s]),o=33,a=0;o>1&&0===n[a]&&!(128&n[a+1]);--o,++a);return _$bip66_187.encode(e.slice(i),n.slice(a))},_$der_353.signatureImport=function(t){var e=__Buffer_353.alloc(32,0),r=__Buffer_353.alloc(32,0);try{var i=_$bip66_187.decode(t);if(33===i.r.length&&0===i.r[0]&&(i.r=i.r.slice(1)),i.r.length>32)throw new Error("R length is too long");if(33===i.s.length&&0===i.s[0]&&(i.s=i.s.slice(1)),i.s.length>32)throw new Error("S length is too long")}catch(err){return}return i.r.copy(e,32-i.r.length),i.s.copy(r,32-i.s.length),{r:e,s:r}},_$der_353.signatureImportLax=function(t){var e=__Buffer_353.alloc(32,0),r=__Buffer_353.alloc(32,0),i=t.length,n=0;if(48===t[n++]){var o=t[n++];if(!(128&o&&(n+=o-128)>i)&&2===t[n++]){var a=t[n++];if(128&a){if(n+(o=a-128)>i)return;for(;o>0&&0===t[n];n+=1,o-=1);for(a=0;o>0;n+=1,o-=1)a=(a<<8)+t[n]}if(!(a>i-n)){var s=n;if(n+=a,2===t[n++]){var u=t[n++];if(128&u){if(n+(o=u-128)>i)return;for(;o>0&&0===t[n];n+=1,o-=1);for(u=0;o>0;n+=1,o-=1)u=(u<<8)+t[n]}if(!(u>i-n)){var h=n;for(n+=u;a>0&&0===t[s];a-=1,s+=1);if(!(a>32)){var f=t.slice(s,s+a);for(f.copy(e,32-f.length);u>0&&0===t[h];u-=1,h+=1);if(!(u>32)){var c=t.slice(h,h+u);return c.copy(r,32-c.length),{r:e,s:r}}}}}}}}};var _$messages_356={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"};function initCompressedValue(t,e){return void 0===t?e:(_$assert_352.isBoolean(t,_$messages_356.COMPRESSED_TYPE_INVALID),t)}var _$lib_355=function(t){return{privateKeyVerify:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),32===e.length&&t.privateKeyVerify(e)},privateKeyExport:function(e,r){_$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0);var i=t.privateKeyExport(e,r);return _$der_353.privateKeyExport(e,i,r)},privateKeyImport:function(e){if(_$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),(e=_$der_353.privateKeyImport(e))&&32===e.length&&t.privateKeyVerify(e))return e;throw new Error(_$messages_356.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyNegate(e)},privateKeyModInverse:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyModInverse(e)},privateKeyTweakAdd:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),t.privateKeyTweakAdd(e,r)},privateKeyTweakMul:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),t.privateKeyTweakMul(e,r)},publicKeyCreate:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_352.isBufferLength(e,32,_$messages_356.EC_PRIVATE_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0),t.publicKeyCreate(e,r)},publicKeyConvert:function(e,r){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_352.isBufferLength2(e,33,65,_$messages_356.EC_PUBLIC_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0),t.publicKeyConvert(e,r)},publicKeyVerify:function(e){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),t.publicKeyVerify(e)},publicKeyTweakAdd:function(e,r,i){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_352.isBufferLength2(e,33,65,_$messages_356.EC_PUBLIC_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),i=initCompressedValue(i,!0),t.publicKeyTweakAdd(e,r,i)},publicKeyTweakMul:function(e,r,i){return _$assert_352.isBuffer(e,_$messages_356.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_352.isBufferLength2(e,33,65,_$messages_356.EC_PUBLIC_KEY_LENGTH_INVALID),_$assert_352.isBuffer(r,_$messages_356.TWEAK_TYPE_INVALID),_$assert_352.isBufferLength(r,32,_$messages_356.TWEAK_LENGTH_INVALID),i=initCompressedValue(i,!0),t.publicKeyTweakMul(e,r,i)},publicKeyCombine:function(e,r){_$assert_352.isArray(e,_$messages_356.EC_PUBLIC_KEYS_TYPE_INVALID),_$assert_352.isLengthGTZero(e,_$messages_356.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=a(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return this.toArrayLike(n,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 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},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){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()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){return this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new i(1),o=new i(0),a=new i(0),s=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(f)),n.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(s)):(r.isub(e),a.isub(n),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},i.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new i(1),a=new i(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return this._forceRed(t)},i.prototype.redAdd=function(t){return this.red.add(this,t)},i.prototype.redIAdd=function(t){return this.red.iadd(this,t)},i.prototype.redSub=function(t){return this.red.sub(this,t)},i.prototype.redISub=function(t){return this.red.isub(this,t)},i.prototype.redShl=function(t){return this.red.shl(this,t)},i.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},r(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new i(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),n=0;!r.isZero()&&0===r.andln(1);)n++,r.iushrn(1);var o=new i(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=n;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new i(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n=0;n--){for(var h=e.words[n],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},r(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_189,this),_$bn_189=_$bn_189.exports;var _$package_286={version:"6.5.4"},_$minimalisticAssert_324={};function __assert_324(t,e){if(!t)throw new Error(e||"Assertion failed")}_$minimalisticAssert_324=__assert_324,__assert_324.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var _$utils_325={},utils=_$utils_325;function zero2(t){return 1===t.length?"0"+t:t}function toHex(t){for(var e="",r=0;r>8,a=255&n;o?r.push(o,a):r.push(a)}return r},utils.zero2=zero2,utils.toHex=toHex,utils.encode=function(t,e){return"hex"===e?toHex(t):t};var _$utils_285={},__utils_285=_$utils_285;__utils_285.assert=_$minimalisticAssert_324,__utils_285.toArray=_$utils_325.toArray,__utils_285.zero2=_$utils_325.zero2,__utils_285.toHex=_$utils_325.toHex,__utils_285.encode=_$utils_325.encode,__utils_285.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?(n>>1)-u:u,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},__utils_285.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+n&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),a=0==(1&u)?0:3!=(i=t.andln(7)+n&7)&&5!==i||2!==h?u:-u,r[0].push(a),s=0==(1&h)?0:3!=(i=e.andln(7)+o&7)&&5!==i||2!==u?h:-h,r[1].push(s),2*n===a+1&&(n=1-n),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},__utils_285.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},__utils_285.parseBytes=function(t){return"string"==typeof t?__utils_285.toArray(t,"hex"):t},__utils_285.intFromLE=function(t){return new _$bn_189(t,"hex","le")};var _$brorand_190={},r;function Rand(t){this.rand=t}if(_$brorand_190=function(t){return r||(r=new Rand(null)),r.generate(t)},_$brorand_190.Rand=Rand,Rand.prototype.generate=function(t){return this._rand(t)},Rand.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(t,e){this.curve=t,this.type=e,this.precomputed=null}_$utils_285.assert,_$base_272=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(t,e){var r=t._getDoubles(),i=getNAF(e,1,this._bitLength),n=(1<=o;u--)a=(a<<1)+i[u];s.push(a)}for(var h=this.jpoint(null,null,null),f=this.jpoint(null,null,null),c=n;c>0;c--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var h=o[s];a="affine"===t.type?h>0?a.mixedAdd(n[h-1>>1]):a.mixedAdd(n[-h-1>>1].neg()):h>0?a.add(n[h-1>>1]):a.add(n[-h-1>>1].neg())}return"affine"===t.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(t,e,r,i,n){var o,a,s,u=this._wnafT1,h=this._wnafT2,f=this._wnafT3,c=0;for(o=0;o=1;o-=2){var _=o-1,d=o;if(1===u[_]&&1===u[d]){var p=[e[_],null,null,e[d]];0===e[_].y.cmp(e[d].y)?(p[1]=e[_].add(e[d]),p[2]=e[_].toJ().mixedAdd(e[d].neg())):0===e[_].y.cmp(e[d].y.redNeg())?(p[1]=e[_].toJ().mixedAdd(e[d]),p[2]=e[_].add(e[d].neg())):(p[1]=e[_].toJ().mixedAdd(e[d]),p[2]=e[_].toJ().mixedAdd(e[d].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=getJSF(r[_],r[d]);for(c=Math.max(b[0].length,c),f[_]=new Array(c),f[d]=new Array(c),a=0;a=0;o--){for(var M=0;o>=0;){var S=!0;for(a=0;a=0&&M++,y=y.dblp(M),o<0)break;for(a=0;a0?s=h[a][$-1>>1]:$<0&&(s=h[a][-$-1>>1].neg()),y="affine"===s.type?y.mixedAdd(s):y.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},BasePoint.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n=0&&(o=e,a=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:n},{a:o,b:a}]},ShortCurve.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),h=o.mul(i.b);return{k1:t.sub(a).sub(s),k2:u.add(h).neg()}},ShortCurve.prototype.pointFromX=function(t,e){(t=new _$bn_189(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},ShortCurve.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},__Point_276.prototype.isInfinity=function(){return this.inf},__Point_276.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},__Point_276.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},__Point_276.prototype.getX=function(){return this.x.fromRed()},__Point_276.prototype.getY=function(){return this.y.fromRed()},__Point_276.prototype.mul=function(t){return t=new _$bn_189(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)},__Point_276.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},__Point_276.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},__Point_276.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))},__Point_276.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},__Point_276.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},_$inherits_browser_317(JPoint,_$base_272.BasePoint),ShortCurve.prototype.jpoint=function(t,e,r){return new JPoint(this,t,e,r)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),_=u.redMul(c.redISub(l)).redISub(o.redMul(f)),d=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,_,d)},JPoint.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),_=this.z.redMul(a);return this.curve.jpoint(c,l,_)},JPoint.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(n),0===this.x.cmp(r))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _$mont_275={};function MontCurve(t){_$base_272.call(this,"mont",t),this.a=new _$bn_189(t.a,16).toRed(this.red),this.b=new _$bn_189(t.b,16).toRed(this.red),this.i4=new _$bn_189(4).toRed(this.red).redInvm(),this.two=new _$bn_189(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function __Point_275(t,e,r){_$base_272.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _$bn_189(e,16),this.z=new _$bn_189(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}_$inherits_browser_317(MontCurve,_$base_272),_$mont_275=MontCurve,MontCurve.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},_$inherits_browser_317(__Point_275,_$base_272.BasePoint),MontCurve.prototype.decodePoint=function(t,e){return this.point(_$utils_285.toArray(t,e),1)},MontCurve.prototype.point=function(t,e){return new __Point_275(this,t,e)},MontCurve.prototype.pointFromJSON=function(t){return __Point_275.fromJSON(this,t)},__Point_275.prototype.precompute=function(){},__Point_275.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},__Point_275.fromJSON=function(t,e){return new __Point_275(t,e[0],e[1]||t.one)},__Point_275.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_275.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},__Point_275.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},__Point_275.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},__Point_275.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=n.redMul(i),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},__Point_275.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},__Point_275.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_275.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_275.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},__Point_275.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},__Point_275.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var _$edwards_273={};function EdwardsCurve(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,_$base_272.call(this,"edwards",t),this.a=new _$bn_189(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _$bn_189(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _$bn_189(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),this.oneC=1==(0|t.c)}function __Point_273(t,e,r,i,n){_$base_272.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _$bn_189(e,16),this.y=new _$bn_189(r,16),this.z=i?new _$bn_189(i,16):this.curve.one,this.t=n&&new _$bn_189(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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}_$utils_285.assert,_$inherits_browser_317(EdwardsCurve,_$base_272),_$edwards_273=EdwardsCurve,EdwardsCurve.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},EdwardsCurve.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},EdwardsCurve.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},EdwardsCurve.prototype.pointFromX=function(t,e){(t=new _$bn_189(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},EdwardsCurve.prototype.pointFromY=function(t,e){(t=new _$bn_189(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(n.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},EdwardsCurve.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},_$inherits_browser_317(__Point_273,_$base_272.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(t){return __Point_273.fromJSON(this,t)},EdwardsCurve.prototype.point=function(t,e,r,i){return new __Point_273(this,t,e,r,i)},__Point_273.fromJSON=function(t,e){return new __Point_273(t,e[0],e[1],e[2])},__Point_273.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_273.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},__Point_273.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),a=o.redSub(r),s=i.redSub(e),u=n.redMul(a),h=o.redMul(s),f=n.redMul(s),c=a.redMul(o);return this.curve.point(u,h,c,f)},__Point_273.prototype._projDbl=function(){var t,e,r,i,n,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var h=(i=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(h.redSub(this.curve.two)),e=h.redMul(i.redSub(u)),r=h.redSqr().redSub(h).redSub(h)):(n=this.z.redSqr(),o=h.redSub(n).redISub(n),t=a.redSub(s).redISub(u).redMul(o),e=h.redMul(i.redSub(u)),r=h.redMul(o))}else i=s.redAdd(u),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),t=this.curve._mulC(a.redISub(i)).redMul(o),e=this.curve._mulC(i).redMul(s.redISub(u)),r=i.redMul(o);return this.curve.point(t,e,r)},__Point_273.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},__Point_273.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=o.redMul(a),f=s.redMul(u),c=o.redMul(u),l=a.redMul(s);return this.curve.point(h,f,l,c)},__Point_273.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=i.redMul(h).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},__Point_273.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},__Point_273.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},__Point_273.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},__Point_273.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},__Point_273.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},__Point_273.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},__Point_273.prototype.getX=function(){return this.normalize(),this.x.fromRed()},__Point_273.prototype.getY=function(){return this.normalize(),this.y.fromRed()},__Point_273.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},__Point_273.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},__Point_273.prototype.toP=__Point_273.prototype.normalize,__Point_273.prototype.mixedAdd=__Point_273.prototype.add;var _$curve_274={},__curve_274=_$curve_274;__curve_274.base=_$base_272,__curve_274.short=_$short_276,__curve_274.mont=_$mont_275,__curve_274.edwards=_$edwards_273;var _$utils_315={};function isSurrogatePair(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function htonl(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function __zero2_315(t){return 1===t.length?"0"+t:t}function zero8(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}_$utils_315.inherits=_$inherits_browser_317,_$utils_315.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):isSurrogatePair(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return n},_$utils_315.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},_$utils_315.rotr32=function(t,e){return t>>>e|t<<32-e},_$utils_315.rotl32=function(t,e){return t<>>32-e},_$utils_315.sum32=function(t,e){return t+e>>>0},_$utils_315.sum32_3=function(t,e,r){return t+e+r>>>0},_$utils_315.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},_$utils_315.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},_$utils_315.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},_$utils_315.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},_$utils_315.sum64_lo=function(t,e,r,i){return e+i>>>0},_$utils_315.sum64_4_hi=function(t,e,r,i,n,o,a,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},_$utils_315.sum64_4_lo=function(t,e,r,i,n,o,a,s){return e+i+o+s>>>0},_$utils_315.sum64_5_hi=function(t,e,r,i,n,o,a,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},_$utils_315.sum64_5_lo=function(t,e,r,i,n,o,a,s,u,h){return e+i+o+s+h>>>0},_$utils_315.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},_$utils_315.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},_$utils_315.shr64_hi=function(t,e,r){return t>>>r},_$utils_315.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var _$common_305={};function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_$common_305.BlockHash=BlockHash,BlockHash.prototype.update=function(t,e){if(t=_$utils_315.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=_$utils_315.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o>>3},_$common_314.g1_256=function(t){return rotr32(t,17)^rotr32(t,19)^t>>>10};var _$1_309={},rotl32=_$utils_315.rotl32,sum32=_$utils_315.sum32,sum32_5=_$utils_315.sum32_5,ft_1=_$common_314.ft_1,__BlockHash_309=_$common_305.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;__BlockHash_309.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}_$utils_315.inherits(SHA1,__BlockHash_309),_$1_309=SHA1,SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest());for(var e=t.length;ethis.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=_$utils_325.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length"};var _$signature_280={};function Signature(t,e){if(t instanceof Signature)return t;this._importDER(t,e)||(this.r=new _$bn_189(t.r,16),this.s=new _$bn_189(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function Position(){this.place=0}function getLength(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,a=e.place;o>>=0;return!(n<=127)&&(e.place=a,n)}function rmPadding(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)}}_$utils_285.assert,_$signature_280=Signature,Signature.prototype._importDER=function(t,e){t=_$utils_285.toArray(t,e);var r=new Position;if(48!==t[r.place++])return!1;var i=getLength(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=getLength(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=getLength(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new _$bn_189(o),this.s=new _$bn_189(s),this.recoveryParam=null,!0},Signature.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=rmPadding(e),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];constructLength(i,e.length),(i=i.concat(e)).push(2),constructLength(i,r.length);var n=i.concat(r),o=[48];return constructLength(o,n.length),o=o.concat(n),_$utils_285.encode(o,t)};var _$ec_278={},__KeyPair_278=(_$utils_285.assert,_$key_279);function EC(t){if(!(this instanceof EC))return new EC(t);"string"==typeof t&&(t=_$curves_277[t]),t instanceof _$curves_277.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}_$ec_278=EC,EC.prototype.keyPair=function(t){return new __KeyPair_278(this,t)},EC.prototype.keyFromPrivate=function(t,e){return __KeyPair_278.fromPrivate(this,t,e)},EC.prototype.keyFromPublic=function(t,e){return __KeyPair_278.fromPublic(this,t,e)},EC.prototype.genKeyPair=function(t){t||(t={});for(var e=new _$hmacDrbg_316({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_$brorand_190(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _$bn_189(2));;){var n=new _$bn_189(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},EC.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},EC.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new _$bn_189(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),a=t.toArray("be",n),s=new _$hmacDrbg_316({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new _$bn_189(1)),h=0;;h++){var f=i.k?i.k(h):new _$bn_189(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var c=this.g.mul(f);if(!c.isInfinity()){var l=c.getX(),_=l.umod(this.n);if(0!==_.cmpn(0)){var d=f.invm(this.n).mul(_.mul(e.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var p=(c.getY().isOdd()?1:0)|(0!==l.cmp(_)?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),p^=1),new _$signature_280({r:_,s:d,recoveryParam:p})}}}}}},EC.prototype.verify=function(t,e,r,i){t=this._truncateToN(new _$bn_189(t,16)),r=this.keyFromPublic(r,i);var n=(e=new _$signature_280(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),h=s.mul(n).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(n):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(n)},EC.prototype.recoverPubKey=function(t,e,r,i){e=new _$signature_280(e,i);var n=this.n,o=new _$bn_189(t),a=e.r,s=e.s,u=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=e.r.invm(n),c=n.sub(o).mul(f).umod(n),l=s.mul(f).umod(n);return this.g.mulAdd(c,a,l)},EC.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new _$signature_280(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var _$key_282={},parseBytes=(_$utils_285.assert,_$utils_285.parseBytes),cachedProperty=_$utils_285.cachedProperty;function __KeyPair_282(t,e){this.eddsa=t,this._secret=parseBytes(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=parseBytes(e.pub)}__KeyPair_282.fromPublic=function(t,e){return e instanceof __KeyPair_282?e:new __KeyPair_282(t,{pub:e})},__KeyPair_282.fromSecret=function(t,e){return e instanceof __KeyPair_282?e:new __KeyPair_282(t,{secret:e})},__KeyPair_282.prototype.secret=function(){return this._secret},cachedProperty(__KeyPair_282,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty(__KeyPair_282,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty(__KeyPair_282,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),cachedProperty(__KeyPair_282,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty(__KeyPair_282,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty(__KeyPair_282,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),__KeyPair_282.prototype.sign=function(t){return this.eddsa.sign(t,this)},__KeyPair_282.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},__KeyPair_282.prototype.getSecret=function(t){return _$utils_285.encode(this.secret(),t)},__KeyPair_282.prototype.getPublic=function(t){return _$utils_285.encode(this.pubBytes(),t)},_$key_282=__KeyPair_282;var _$signature_283={},__cachedProperty_283=(_$utils_285.assert,_$utils_285.cachedProperty),__parseBytes_283=_$utils_285.parseBytes;function __Signature_283(t,e){this.eddsa=t,"object"!=typeof e&&(e=__parseBytes_283(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof _$bn_189&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}__cachedProperty_283(__Signature_283,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),__cachedProperty_283(__Signature_283,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),__cachedProperty_283(__Signature_283,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),__cachedProperty_283(__Signature_283,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),__Signature_283.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},__Signature_283.prototype.toHex=function(){return _$utils_285.encode(this.toBytes(),"hex").toUpperCase()},_$signature_283=__Signature_283;var _$eddsa_281={},__parseBytes_281=(_$utils_285.assert,_$utils_285.parseBytes);function EDDSA(t){if(!(this instanceof EDDSA))return new EDDSA(t);t=_$curves_277[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=_$hash_304.sha512}_$eddsa_281=EDDSA,EDDSA.prototype.sign=function(t,e){t=__parseBytes_281(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:o})},EDDSA.prototype.verify=function(t,e,r){t=__parseBytes_281(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},EDDSA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0)return null;var i=(r=r.toRed(ecparams.red)).redSqr().redIMul(r).redIAdd(ecparams.b).redSqrt();return 3===t!==i.isOdd()&&(i=i.redNeg()),ec.keyPair({pub:{x:r,y:i}})}(e,t.slice(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){var i=new _$bn_189(e),n=new _$bn_189(r);if(i.cmp(ecparams.p)>=0||n.cmp(ecparams.p)>=0)return null;if(i=i.toRed(ecparams.red),n=n.toRed(ecparams.red),(6===t||7===t)&&n.isOdd()!==(7===t))return null;var o=i.redSqr().redIMul(i);return n.redSqr().redISub(o.redIAdd(ecparams.b)).isZero()?ec.keyPair({pub:{x:i,y:n}}):null}(e,t.slice(1,33),t.slice(33,65));default:return null}}_$elliptic_354.privateKeyVerify=function(t){var e=new _$bn_189(t);return e.cmp(ecparams.n)<0&&!e.isZero()},_$elliptic_354.privateKeyExport=function(t,e){var r=new _$bn_189(t);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return __Buffer_354.from(ec.keyFromPrivate(t).getPublic(e,!0))},_$elliptic_354.privateKeyNegate=function(t){var e=new _$bn_189(t);return e.isZero()?__Buffer_354.alloc(32):ecparams.n.sub(e).umod(ecparams.n).toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.privateKeyModInverse=function(t){var e=new _$bn_189(t);if(e.cmp(ecparams.n)>=0||e.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_RANGE_INVALID);return e.invm(ecparams.n).toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.privateKeyTweakAdd=function(t,e){var r=new _$bn_189(e);if(r.cmp(ecparams.n)>=0)throw new Error(_$messages_356.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new _$bn_189(t)),r.cmp(ecparams.n)>=0&&r.isub(ecparams.n),r.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.privateKeyTweakMul=function(t,e){var r=new _$bn_189(e);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_356.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new _$bn_189(t)),r.cmp(ecparams.n)&&(r=r.umod(ecparams.n)),r.toArrayLike(__Buffer_354,"be",32)},_$elliptic_354.publicKeyCreate=function(t,e){var r=new _$bn_189(t);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_356.EC_PUBLIC_KEY_CREATE_FAIL);return __Buffer_354.from(ec.keyFromPrivate(t).getPublic(e,!0))},_$elliptic_354.publicKeyConvert=function(t,e){var r=loadPublicKey(t);if(null===r)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);return __Buffer_354.from(r.getPublic(e,!0))},_$elliptic_354.publicKeyVerify=function(t){return null!==loadPublicKey(t)},_$elliptic_354.publicKeyTweakAdd=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);if((e=new _$bn_189(e)).cmp(ecparams.n)>=0)throw new Error(_$messages_356.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var n=ecparams.g.mul(e).add(i.pub);if(n.isInfinity())throw new Error(_$messages_356.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return __Buffer_354.from(n.encode(!0,r))},_$elliptic_354.publicKeyTweakMul=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);if((e=new _$bn_189(e)).cmp(ecparams.n)>=0||e.isZero())throw new Error(_$messages_356.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return __Buffer_354.from(i.pub.mul(e).encode(!0,r))},_$elliptic_354.publicKeyCombine=function(t,e){for(var r=new Array(t.length),i=0;i=0||r.cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);var i=__Buffer_354.from(t);return 1===r.cmp(ec.nh)&&ecparams.n.sub(r).toArrayLike(__Buffer_354,"be",32).copy(i,32),i},_$elliptic_354.signatureExport=function(t){var e=t.slice(0,32),r=t.slice(32,64);if(new _$bn_189(e).cmp(ecparams.n)>=0||new _$bn_189(r).cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);return{r:e,s:r}},_$elliptic_354.signatureImport=function(t){var e=new _$bn_189(t.r);e.cmp(ecparams.n)>=0&&(e=new _$bn_189(0));var r=new _$bn_189(t.s);return r.cmp(ecparams.n)>=0&&(r=new _$bn_189(0)),__Buffer_354.concat([e.toArrayLike(__Buffer_354,"be",32),r.toArrayLike(__Buffer_354,"be",32)])},_$elliptic_354.sign=function(t,e,r,i){if("function"==typeof r){var n=r;r=function(r){var o=n(t,e,null,i,r);if(!__Buffer_354.isBuffer(o)||32!==o.length)throw new Error(_$messages_356.ECDSA_SIGN_FAIL);return new _$bn_189(o)}}var o=new _$bn_189(e);if(o.cmp(ecparams.n)>=0||o.isZero())throw new Error(_$messages_356.ECDSA_SIGN_FAIL);var a=ec.sign(t,e,{canonical:!0,k:r,pers:i});return{signature:__Buffer_354.concat([a.r.toArrayLike(__Buffer_354,"be",32),a.s.toArrayLike(__Buffer_354,"be",32)]),recovery:a.recoveryParam}},_$elliptic_354.verify=function(t,e,r){var i={r:e.slice(0,32),s:e.slice(32,64)},n=new _$bn_189(i.r),o=new _$bn_189(i.s);if(n.cmp(ecparams.n)>=0||o.cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);if(1===o.cmp(ec.nh)||n.isZero()||o.isZero())return!1;var a=loadPublicKey(r);if(null===a)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);return ec.verify(t,i,{x:a.pub.x,y:a.pub.y})},_$elliptic_354.recover=function(t,e,r,i){var n={r:e.slice(0,32),s:e.slice(32,64)},o=new _$bn_189(n.r),a=new _$bn_189(n.s);if(o.cmp(ecparams.n)>=0||a.cmp(ecparams.n)>=0)throw new Error(_$messages_356.ECDSA_SIGNATURE_PARSE_FAIL);try{if(o.isZero()||a.isZero())throw new Error;var s=ec.recoverPubKey(t,n,r);return __Buffer_354.from(s.encode(!0,i))}catch(err){throw new Error(_$messages_356.ECDSA_RECOVER_FAIL)}},_$elliptic_354.ecdh=function(t,e){var r=_$elliptic_354.ecdhUnsafe(t,e,!0);return _$browser_224("sha256").update(r).digest()},_$elliptic_354.ecdhUnsafe=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_356.EC_PUBLIC_KEY_PARSE_FAIL);var n=new _$bn_189(e);if(n.cmp(ecparams.n)>=0||n.isZero())throw new Error(_$messages_356.ECDH_FAIL);return __Buffer_354.from(i.pub.mul(n).encode(!0,r))};var _$elliptic_351=_$lib_355(_$elliptic_354),_$bitcoinjsMessage_188={};(function(t){const r="p2wpkh",i="p2sh(p2wpkh)";function n(t){return _$browser_224("sha256").update(t).digest()}function o(t){return _$browser_224("ripemd160").update(n(t)).digest()}function a(e,r){r=r||"\x18Bitcoin Signed Message:\n",t.isBuffer(r)||(r=t.from(r,"utf8")),t.isBuffer(e)||(e=t.from(e,"utf8"));const i=_$varuintBitcoin_392.encodingLength(e.length),o=t.allocUnsafe(r.length+i+e.length);return r.copy(o,0),_$varuintBitcoin_392.encode(e.length,o,r.length),e.copy(o,r.length+i),function(t){return n(n(t))}(o)}function s(e){return o(t.concat([t.from("0014","hex"),e]))}function u(e){const r=_$bech32_161.decode(e),i=_$bech32_161.fromWords(r.words.slice(1));return t.from(i)}_$bitcoinjsMessage_188={sign:function(e,n,o,s,u){const{messagePrefixArg:h,segwitType:f,extraEntropy:c}=function(t,e){"object"==typeof t&&void 0===e&&(e=t,t=void 0);let{segwitType:n,extraEntropy:o}=e||{};if(n&&("string"==typeof n||n instanceof String)&&(n=n.toLowerCase()),n&&n!==i&&n!==r)throw new Error('Unrecognized segwitType: use "'+i+'" or "'+r+'"');return{messagePrefixArg:t,segwitType:n,extraEntropy:o}}(s,u),l=a(e,h),_=function(t){return t&&"function"==typeof t.sign}(n)?n.sign(l,c):_$elliptic_351.sign(l,n,{data:c});return function(e,i,n,o){return void 0!==o?(i+=8,o===r&&(i+=4)):n&&(i+=4),t.concat([t.alloc(1,i+27),e])}(_.signature,_.recovery,o,f)},verify:function(n,h,f,c,l){t.isBuffer(f)||(f=t.from(f,"base64"));const _=function(t){if(65!==t.length)throw new Error("Invalid signature length");const e=t.readUInt8(0)-27;if(e>15||e<0)throw new Error("Invalid signature parameter");return{compressed:!!(12&e),segwitType:8&e?4&e?r:i:null,recovery:3&e,signature:t.slice(1)}}(f);if(l&&!_.compressed)throw new Error("checkSegwitAlways can only be used with a compressed pubkey signature flagbyte");const d=a(n,c),p=o(_$elliptic_351.recover(d,_.signature,_.recovery,_.compressed));let m,b;if(_.segwitType)_.segwitType===i?(m=s(p),b=_$bs58check_210.decode(h).slice(1)):(m=p,b=u(h));else if(l)try{return b=u(h),_$bufferEquals_211(p,b)}catch(e){const r=s(p);return b=_$bs58check_210.decode(h).slice(1),_$bufferEquals_211(p,b)||_$bufferEquals_211(r,b)}else m=p,b=_$bs58check_210.decode(h).slice(1);return _$bufferEquals_211(m,b)}}}).call(this,_$buffer_460({}).Buffer);var replace=String.prototype.replace,percentTwenties=/%20/g,Format_RFC1738="RFC1738",Format_RFC3986="RFC3986",_$formats_335={default:Format_RFC3986,formatters:{RFC1738:function(t){return replace.call(t,percentTwenties,"+")},RFC3986:function(t){return String(t)}},RFC1738:Format_RFC1738,RFC3986:Format_RFC3986},has=Object.prototype.hasOwnProperty,isArray=Array.isArray,hexTable=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),arrayToObject=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},i=0;i1;){var e=t.pop(),r=e.obj[e.prop];if(isArray(r)){for(var i=[],n=0;n=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===_$formats_335.RFC1738&&(40===u||41===u)?a+=o.charAt(s):u<128?a+=hexTable[u]:u<2048?a+=hexTable[192|u>>6]+hexTable[128|63&u]:u<55296||u>=57344?a+=hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|63&u]:(s+=1,u=65536+((1023&u)<<10|1023&o.charCodeAt(s)),a+=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|63&u])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(isArray(t)){for(var r=[],i=0;i0?m.join(",")||null:void 0}];else if(__isArray_338(s))b=s;else{var v=Object.keys(m);b=u?v.sort(u):v}for(var y=0;y0?c+f:""},__has_337=Object.prototype.hasOwnProperty,__isArray_337=Array.isArray,__defaults_337={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:_$utils_339.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},parseArrayValue=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},parseKeys=function(t,e,r,i){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),s=a?n.slice(0,a.index):n,u=[];if(s){if(!r.plainObjects&&__has_337.call(Object.prototype,s)&&!r.allowPrototypes)return;u.push(s)}for(var h=0;r.depth>0&&null!==(a=o.exec(n))&&h=0;--o){var a,s=t[o];if("[]"===s&&r.parseArrays)a=[].concat(n);else{a=r.plainObjects?Object.create(null):{};var u="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,h=parseInt(u,10);r.parseArrays||""!==u?!isNaN(h)&&s!==u&&String(h)===u&&h>=0&&r.parseArrays&&h<=r.arrayLimit?(a=[])[h]=n:a[u]=n:a={0:n}}n=a}return n}(u,e,r,i)}},_$parse_337=function(t,e){var r=function(t){if(!t)return __defaults_337;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?__defaults_337.charset:t.charset;return{allowDots:void 0===t.allowDots?__defaults_337.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:__defaults_337.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:__defaults_337.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:__defaults_337.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:__defaults_337.comma,decoder:"function"==typeof t.decoder?t.decoder:__defaults_337.decoder,delimiter:"string"==typeof t.delimiter||_$utils_339.isRegExp(t.delimiter)?t.delimiter:__defaults_337.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:__defaults_337.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:__defaults_337.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:__defaults_337.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:__defaults_337.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:__defaults_337.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){var r,i={},n=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,o=e.parameterLimit===1/0?void 0:e.parameterLimit,a=n.split(e.delimiter,o),s=-1,u=e.charset;if(e.charsetSentinel)for(r=0;r-1&&(f=__isArray_337(f)?[f]:f),__has_337.call(i,h)?i[h]=_$utils_339.combine(i[h],f):i[h]=f}return i}(t,r):t,n=r.plainObjects?Object.create(null):{},o=Object.keys(i),a=0;a>o%8,t._prev=shiftIn(t._prev,r?i:n);return a}function shiftIn(t,e){var r=t.length,i=-1,n=__Buffer_200.allocUnsafe(t.length);for(t=__Buffer_200.concat([t,__Buffer_200.from([e])]);++i>7;return n}_$cfb1_200.encrypt=function(t,e,r){for(var i=e.length,n=__Buffer_200.allocUnsafe(i),o=-1;++o>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&m]^e[b++],a=h[d>>>24]^f[p>>>16&255]^c[m>>>8&255]^l[255&_]^e[b++],s=h[p>>>24]^f[m>>>16&255]^c[_>>>8&255]^l[255&d]^e[b++],u=h[m>>>24]^f[_>>>16&255]^c[d>>>8&255]^l[255&p]^e[b++],_=o,d=a,p=s,m=u;return o=(i[_>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[b++],a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&_])^e[b++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[_>>>8&255]<<8|i[255&d])^e[b++],u=(i[m>>>24]<<24|i[_>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[a]=h,i[h]=a;var f=t[a],c=t[f],l=t[c],_=257*t[h]^16843008*h;n[0][a]=_<<24|_>>>8,n[1][a]=_<<16|_>>>16,n[2][a]=_<<8|_>>>24,n[3][a]=_,_=16843009*l^65537*c^257*f^16843008*a,o[0][h]=_<<24|_>>>8,o[1][h]=_<<16|_>>>16,o[2][h]=_<<8|_>>>24,o[3][h]=_,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function AES(t){this._key=asUInt32Array(t),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,a=G.SBOX[a>>>24]<<24|G.SBOX[a>>>16&255]<<16|G.SBOX[a>>>8&255]<<8|G.SBOX[255&a],a^=RCON[o/e|0]<<24):e>6&&o%e==4&&(a=G.SBOX[a>>>24]<<24|G.SBOX[a>>>16&255]<<16|G.SBOX[a>>>8&255]<<8|G.SBOX[255&a]),n[o]=n[o-e]^a}for(var s=[],u=0;u>>24]]^G.INV_SUB_MIX[1][G.SBOX[f>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[f>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},AES.prototype.encryptBlockRaw=function(t){return cryptBlock(t=asUInt32Array(t),this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=__Buffer_191.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},AES.prototype.decryptBlock=function(t){var e=(t=asUInt32Array(t))[1];t[1]=t[3],t[3]=e;var r=cryptBlock(t,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),i=__Buffer_191.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},_$aes_191.AES=AES;var _$ghash_196={},__Buffer_196=_$safeBuffer_345.Buffer,ZEROES=__Buffer_196.alloc(16,0);function fromArray(t){var e=__Buffer_196.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function GHASH(t){this.h=t,this.state=__Buffer_196.alloc(16,0),this.cache=__Buffer_196.allocUnsafe(0)}GHASH.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=fromArray(n)},GHASH.prototype.update=function(t){var e;for(this.cache=__Buffer_196.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},GHASH.prototype.final=function(t,e){return this.cache.length&&this.ghash(__Buffer_196.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,t,0,e])),this.state},_$ghash_196=GHASH;var _$authCipher_192={},__Buffer_192=_$safeBuffer_345.Buffer;function StreamCipher(t,e,r,i){_$cipherBase_223.call(this);var n=__Buffer_192.alloc(4,0);this._cipher=new _$aes_191.AES(e);var o=this._cipher.encryptBlock(n);this._ghash=new _$ghash_196(o),r=function(t,e,r){if(12===e.length)return t._finID=__Buffer_192.concat([e,__Buffer_192.from([0,0,0,1])]),__Buffer_192.concat([e,__Buffer_192.from([0,0,0,2])]);var i=new _$ghash_196(r),n=e.length,o=n%16;i.update(e),o&&(o=16-o,i.update(__Buffer_192.alloc(o,0))),i.update(__Buffer_192.alloc(8,0));var a=8*n,s=__Buffer_192.alloc(8);s.writeUIntBE(a,0,8),i.update(s),t._finID=i.state;var u=__Buffer_192.from(t._finID);return _$incr32_197(u),u}(this,r,o),this._prev=__Buffer_192.from(r),this._cache=__Buffer_192.allocUnsafe(0),this._secCache=__Buffer_192.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}_$inherits_browser_317(StreamCipher,_$cipherBase_223),StreamCipher.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=__Buffer_192.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},StreamCipher.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=_$bufferXor_212(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n0||i>0;){var u=new _$md5Js_321;u.update(s),u.update(t),e&&u.update(e),s=u.digest();var h=0;if(n>0){var f=o.length-n;h=Math.min(n,s.length),s.copy(o,f,0,h),n-=h}if(h0){var c=a.length-i,l=Math.min(i,s.length-h);s.copy(a,c,h,h+l),i-=l}}return s.fill(0),{key:o,iv:a}},_$encrypter_195={},__Buffer_195=_$safeBuffer_345.Buffer;function Cipher(t,e,r){_$cipherBase_223.call(this),this._cache=new Splitter,this._cipher=new _$aes_191.AES(e),this._prev=__Buffer_195.from(r),this._mode=t,this._autopadding=!0}_$inherits_browser_317(Cipher,_$cipherBase_223),Cipher.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return __Buffer_195.concat(i)};var PADDING=__Buffer_195.alloc(16,16);function Splitter(){this.cache=__Buffer_195.allocUnsafe(0)}function createCipheriv(t,e,r){var i=_$modes_204[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=__Buffer_195.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=__Buffer_195.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new _$streamCipher_207(i.module,e,r):"auth"===i.type?new _$authCipher_192(i.module,e,r):new Cipher(i.module,e,r)}Cipher.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},Splitter.prototype.add=function(t){this.cache=__Buffer_195.concat([this.cache,t])},Splitter.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},Splitter.prototype.flush=function(){for(var t=16-this.cache.length,e=__Buffer_195.allocUnsafe(t),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},__Splitter_194.prototype.flush=function(){if(this.cache.length)return this.cache};var _$browser_193={};_$encrypter_195.createCipher,_$browser_193.createCipheriv=_$encrypter_195.createCipheriv,_$decrypter_194.createDecipher,_$browser_193.createDecipheriv=_$decrypter_194.createDecipheriv;var _$browser_558={};(function(t,e){"use strict";var r=_$safeBuffer_576.Buffer,i=e.crypto||e.msCrypto;_$browser_558=i&&i.getRandomValues?function(e,n){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a0?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 __Buffer_508.alloc(0);for(var e,r,i,n=__Buffer_508.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_508.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_508.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:__custom_508,value:function(t,e){return __inspect_508(this,function(t){for(var e=1;e2?"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))}__createErrorType_501("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),__createErrorType_501("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(__oneOf_501(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(__oneOf_501(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),__createErrorType_501("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),__createErrorType_501("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),__createErrorType_501("ERR_STREAM_PREMATURE_CLOSE","Premature close"),__createErrorType_501("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),__createErrorType_501("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),__createErrorType_501("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),__createErrorType_501("ERR_STREAM_WRITE_AFTER_END","write after end"),__createErrorType_501("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),__createErrorType_501("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),__createErrorType_501("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_501.codes=__codes_501;var __ERR_INVALID_OPT_VALUE_513=_$errorsBrowser_501.codes.ERR_INVALID_OPT_VALUE,_$state_513={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new __ERR_INVALID_OPT_VALUE_513(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$Transform_505=__Transform_505,___require$codes_505=_$errorsBrowser_501.codes,__ERR_METHOD_NOT_IMPLEMENTED_505=___require$codes_505.ERR_METHOD_NOT_IMPLEMENTED,__ERR_MULTIPLE_CALLBACK_505=___require$codes_505.ERR_MULTIPLE_CALLBACK,__ERR_TRANSFORM_ALREADY_TRANSFORMING_505=___require$codes_505.ERR_TRANSFORM_ALREADY_TRANSFORMING,__ERR_TRANSFORM_WITH_LENGTH_0_505=___require$codes_505.ERR_TRANSFORM_WITH_LENGTH_0,__Duplex_505=_$Duplex_502({});function __afterTransform_505(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new __ERR_MULTIPLE_CALLBACK_505);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(__call_512),a||(o.forEach(__call_512),n(i))}))}));return e.reduce(__pipe_512)},_$readableBrowser_515={};_$readableBrowser_515=_$readableBrowser_515=_$_stream_readable_504({}),_$readableBrowser_515.Stream=_$readableBrowser_515,_$readableBrowser_515.Readable=_$readableBrowser_515,_$readableBrowser_515.Writable=_$_stream_writable_506({}),_$readableBrowser_515.Duplex=_$Duplex_502({}),_$readableBrowser_515.Transform=_$Transform_505,_$readableBrowser_515.PassThrough=_$PassThrough_503,_$readableBrowser_515.finished=_$eos_510({}),_$readableBrowser_515.pipeline=_$pipeline_512;var _$hashBase_500={},__Buffer_500=_$safeBuffer_576.Buffer,__Transform_500=_$readableBrowser_515.Transform;function __HashBase_500(t){__Transform_500.call(this),this._block=__Buffer_500.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}_$inherits_browser_530(__HashBase_500,__Transform_500),__HashBase_500.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(err){i=err}r(i)},__HashBase_500.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(err){e=err}t(e)},__HashBase_500.prototype.update=function(t,e){if(function(t,e){if(!__Buffer_500.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");__Buffer_500.isBuffer(t)||(t=__Buffer_500.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var n=this._blockOffset;n0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},__HashBase_500.prototype._update=function(){throw new Error("_update is not implemented")},__HashBase_500.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},__HashBase_500.prototype._digest=function(){throw new Error("_digest is not implemented")},_$hashBase_500=__HashBase_500;var _$md5Js_533={},__Buffer_533=_$safeBuffer_576.Buffer,__ARRAY16_533=new Array(16);function __MD5_533(){_$hashBase_500.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function __rotl_533(t,e){return t<>>32-e}function __fnF_533(t,e,r,i,n,o,a){return __rotl_533(t+(e&r|~e&i)+n+o|0,a)+e|0}function __fnG_533(t,e,r,i,n,o,a){return __rotl_533(t+(e&i|r&~i)+n+o|0,a)+e|0}function __fnH_533(t,e,r,i,n,o,a){return __rotl_533(t+(e^r^i)+n+o|0,a)+e|0}function __fnI_533(t,e,r,i,n,o,a){return __rotl_533(t+(r^(e|~i))+n+o|0,a)+e|0}_$inherits_browser_530(__MD5_533,_$hashBase_500),__MD5_533.prototype._update=function(){for(var t=__ARRAY16_533,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=__fnF_533(r,i,n,o,t[0],3614090360,7),o=__fnF_533(o,r,i,n,t[1],3905402710,12),n=__fnF_533(n,o,r,i,t[2],606105819,17),i=__fnF_533(i,n,o,r,t[3],3250441966,22),r=__fnF_533(r,i,n,o,t[4],4118548399,7),o=__fnF_533(o,r,i,n,t[5],1200080426,12),n=__fnF_533(n,o,r,i,t[6],2821735955,17),i=__fnF_533(i,n,o,r,t[7],4249261313,22),r=__fnF_533(r,i,n,o,t[8],1770035416,7),o=__fnF_533(o,r,i,n,t[9],2336552879,12),n=__fnF_533(n,o,r,i,t[10],4294925233,17),i=__fnF_533(i,n,o,r,t[11],2304563134,22),r=__fnF_533(r,i,n,o,t[12],1804603682,7),o=__fnF_533(o,r,i,n,t[13],4254626195,12),n=__fnF_533(n,o,r,i,t[14],2792965006,17),r=__fnG_533(r,i=__fnF_533(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=__fnG_533(o,r,i,n,t[6],3225465664,9),n=__fnG_533(n,o,r,i,t[11],643717713,14),i=__fnG_533(i,n,o,r,t[0],3921069994,20),r=__fnG_533(r,i,n,o,t[5],3593408605,5),o=__fnG_533(o,r,i,n,t[10],38016083,9),n=__fnG_533(n,o,r,i,t[15],3634488961,14),i=__fnG_533(i,n,o,r,t[4],3889429448,20),r=__fnG_533(r,i,n,o,t[9],568446438,5),o=__fnG_533(o,r,i,n,t[14],3275163606,9),n=__fnG_533(n,o,r,i,t[3],4107603335,14),i=__fnG_533(i,n,o,r,t[8],1163531501,20),r=__fnG_533(r,i,n,o,t[13],2850285829,5),o=__fnG_533(o,r,i,n,t[2],4243563512,9),n=__fnG_533(n,o,r,i,t[7],1735328473,14),r=__fnH_533(r,i=__fnG_533(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=__fnH_533(o,r,i,n,t[8],2272392833,11),n=__fnH_533(n,o,r,i,t[11],1839030562,16),i=__fnH_533(i,n,o,r,t[14],4259657740,23),r=__fnH_533(r,i,n,o,t[1],2763975236,4),o=__fnH_533(o,r,i,n,t[4],1272893353,11),n=__fnH_533(n,o,r,i,t[7],4139469664,16),i=__fnH_533(i,n,o,r,t[10],3200236656,23),r=__fnH_533(r,i,n,o,t[13],681279174,4),o=__fnH_533(o,r,i,n,t[0],3936430074,11),n=__fnH_533(n,o,r,i,t[3],3572445317,16),i=__fnH_533(i,n,o,r,t[6],76029189,23),r=__fnH_533(r,i,n,o,t[9],3654602809,4),o=__fnH_533(o,r,i,n,t[12],3873151461,11),n=__fnH_533(n,o,r,i,t[15],530742520,16),r=__fnI_533(r,i=__fnH_533(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=__fnI_533(o,r,i,n,t[7],1126891415,10),n=__fnI_533(n,o,r,i,t[14],2878612391,15),i=__fnI_533(i,n,o,r,t[5],4237533241,21),r=__fnI_533(r,i,n,o,t[12],1700485571,6),o=__fnI_533(o,r,i,n,t[3],2399980690,10),n=__fnI_533(n,o,r,i,t[10],4293915773,15),i=__fnI_533(i,n,o,r,t[1],2240044497,21),r=__fnI_533(r,i,n,o,t[8],1873313359,6),o=__fnI_533(o,r,i,n,t[15],4264355552,10),n=__fnI_533(n,o,r,i,t[6],2734768916,15),i=__fnI_533(i,n,o,r,t[13],1309151649,21),r=__fnI_533(r,i,n,o,t[4],4149444226,6),o=__fnI_533(o,r,i,n,t[11],3174756917,10),n=__fnI_533(n,o,r,i,t[2],718787259,15),i=__fnI_533(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},__MD5_533.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=__Buffer_533.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},_$md5Js_533=__MD5_533;var _$ripemd160_575={},__Buffer_575=_$buffer_460({}).Buffer,__ARRAY16_575=new Array(16),__zl_575=[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],__zr_575=[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],__sl_575=[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],__sr_575=[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],__hl_575=[0,1518500249,1859775393,2400959708,2840853838],__hr_575=[1352829926,1548603684,1836072691,2053994217,0];function __RIPEMD160_575(){_$hashBase_500.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function __rotl_575(t,e){return t<>>32-e}function __fn1_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e^r^i)+o+a|0,s)+n|0}function __fn2_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e&r|~e&i)+o+a|0,s)+n|0}function __fn3_575(t,e,r,i,n,o,a,s){return __rotl_575(t+((e|~r)^i)+o+a|0,s)+n|0}function __fn4_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e&i|r&~i)+o+a|0,s)+n|0}function __fn5_575(t,e,r,i,n,o,a,s){return __rotl_575(t+(e^(r|~i))+o+a|0,s)+n|0}_$inherits_browser_530(__RIPEMD160_575,_$hashBase_500),__RIPEMD160_575.prototype._update=function(){for(var t=__ARRAY16_575,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,f=0|this._d,c=0|this._e,l=0;l<80;l+=1){var _,d;l<16?(_=__fn1_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[0],__sl_575[l]),d=__fn5_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[0],__sr_575[l])):l<32?(_=__fn2_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[1],__sl_575[l]),d=__fn4_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[1],__sr_575[l])):l<48?(_=__fn3_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[2],__sl_575[l]),d=__fn3_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[2],__sr_575[l])):l<64?(_=__fn4_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[3],__sl_575[l]),d=__fn2_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[3],__sr_575[l])):(_=__fn5_575(r,i,n,o,a,t[__zl_575[l]],__hl_575[4],__sl_575[l]),d=__fn1_575(s,u,h,f,c,t[__zr_575[l]],__hr_575[4],__sr_575[l])),r=a,a=o,o=__rotl_575(n,10),n=i,i=_,s=c,c=f,f=__rotl_575(h,10),h=u,u=d}var p=this._b+n+f|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+i+h|0,this._a=p},__RIPEMD160_575.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=__Buffer_575.alloc?__Buffer_575.alloc(20):new __Buffer_575(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},_$ripemd160_575=__RIPEMD160_575;var _$hash_577={},__Buffer_577=_$safeBuffer_576.Buffer;function __Hash_577(t,e){this._block=__Buffer_577.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}__Hash_577.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=__Buffer_577.from(t,e));for(var r=this._block,i=this._blockSize,n=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},__Hash_577.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_$hash_577=__Hash_577;var _$sha_579={},__Buffer_579=_$safeBuffer_576.Buffer,__K_579=[1518500249,1859775393,-1894007588,-899497514],__W_579=new Array(80);function __Sha_579(){this.init(),this._w=__W_579,_$hash_577.call(this,64,56)}function __rotl30_579(t){return t<<30|t>>>2}function __ft_579(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_530(__Sha_579,_$hash_577),__Sha_579.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},__Sha_579.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var f=~~(h/20),c=0|((e=i)<<5|e>>>27)+__ft_579(f,n,o,a)+s+r[h]+__K_579[f];s=a,a=o,o=__rotl30_579(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},__Sha_579.prototype._hash=function(){var t=__Buffer_579.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},_$sha_579=__Sha_579;var _$sha1_580={},__Buffer_580=_$safeBuffer_576.Buffer,__K_580=[1518500249,1859775393,-1894007588,-899497514],__W_580=new Array(80);function __Sha1_580(){this.init(),this._w=__W_580,_$hash_577.call(this,64,56)}function __rotl5_580(t){return t<<5|t>>>27}function __rotl30_580(t){return t<<30|t>>>2}function __ft_580(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_530(__Sha1_580,_$hash_577),__Sha1_580.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},__Sha1_580.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=(e=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|e>>>31;for(var h=0;h<80;++h){var f=~~(h/20),c=__rotl5_580(i)+__ft_580(f,n,o,a)+s+r[h]+__K_580[f]|0;s=a,a=o,o=__rotl30_580(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},__Sha1_580.prototype._hash=function(){var t=__Buffer_580.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},_$sha1_580=__Sha1_580;var _$sha256_582={},__Buffer_582=_$safeBuffer_576.Buffer,__K_582=[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],__W_582=new Array(64);function __Sha256_582(){this.init(),this._w=__W_582,_$hash_577.call(this,64,56)}function __ch_582(t,e,r){return r^t&(e^r)}function __maj_582(t,e,r){return t&e|r&(t|e)}function __sigma0_582(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function __sigma1_582(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function __gamma0_582(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}_$inherits_browser_530(__Sha256_582,_$hash_577),__Sha256_582.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},__Sha256_582.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,f=0|this._h,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<64;++c)r[c]=0|(((e=r[c-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[c-7]+__gamma0_582(r[c-15])+r[c-16];for(var l=0;l<64;++l){var _=f+__sigma1_582(s)+__ch_582(s,u,h)+__K_582[l]+r[l]|0,d=__sigma0_582(i)+__maj_582(i,n,o)|0;f=h,h=u,u=s,s=a+_|0,a=o,o=n,n=i,i=_+d|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=f+this._h|0},__Sha256_582.prototype._hash=function(){var t=__Buffer_582.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},_$sha256_582=__Sha256_582;var _$sha224_581={},__Buffer_581=_$safeBuffer_576.Buffer,__W_581=new Array(64);function __Sha224_581(){this.init(),this._w=__W_581,_$hash_577.call(this,64,56)}_$inherits_browser_530(__Sha224_581,_$sha256_582),__Sha224_581.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},__Sha224_581.prototype._hash=function(){var t=__Buffer_581.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},_$sha224_581=__Sha224_581;var _$sha512_584={},__Buffer_584=_$safeBuffer_576.Buffer,__K_584=[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],__W_584=new Array(160);function __Sha512_584(){this.init(),this._w=__W_584,_$hash_577.call(this,128,112)}function __Ch_584(t,e,r){return r^t&(e^r)}function __maj_584(t,e,r){return t&e|r&(t|e)}function __sigma0_584(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function __sigma1_584(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function __Gamma0_584(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function __Gamma0l_584(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function __Gamma1_584(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function __Gamma1l_584(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function __getCarry_584(t,e){return t>>>0>>0?1:0}_$inherits_browser_530(__Sha512_584,_$hash_577),__Sha512_584.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},__Sha512_584.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,f=0|this._al,c=0|this._bl,l=0|this._cl,_=0|this._dl,d=0|this._el,p=0|this._fl,m=0|this._gl,b=0|this._hl,g=0;g<32;g+=2)e[g]=t.readInt32BE(4*g),e[g+1]=t.readInt32BE(4*g+4);for(;g<160;g+=2){var v=e[g-30],y=e[g-30+1],w=__Gamma0_584(v,y),M=__Gamma0l_584(y,v),S=__Gamma1_584(v=e[g-4],y=e[g-4+1]),$=__Gamma1l_584(y,v),E=e[g-14],k=e[g-14+1],A=e[g-32],B=e[g-32+1],x=M+k|0,T=w+E+__getCarry_584(x,M)|0;T=(T=T+S+__getCarry_584(x=x+$|0,$)|0)+A+__getCarry_584(x=x+B|0,B)|0,e[g]=T,e[g+1]=x}for(var R=0;R<160;R+=2){T=e[R],x=e[R+1];var P=__maj_584(r,i,n),I=__maj_584(f,c,l),C=__sigma0_584(r,f),O=__sigma0_584(f,r),N=__sigma1_584(a,d),L=__sigma1_584(d,a),U=__K_584[R],D=__K_584[R+1],z=__Ch_584(a,s,u),j=__Ch_584(d,p,m),H=b+L|0,q=h+N+__getCarry_584(H,b)|0;q=(q=(q=q+z+__getCarry_584(H=H+j|0,j)|0)+U+__getCarry_584(H=H+D|0,D)|0)+T+__getCarry_584(H=H+x|0,x)|0;var F=O+I|0,K=C+P+__getCarry_584(F,O)|0;h=u,b=m,u=s,m=p,s=a,p=d,a=o+q+__getCarry_584(d=_+H|0,_)|0,o=n,_=l,n=i,l=c,i=r,c=f,r=q+K+__getCarry_584(f=H+F|0,H)|0}this._al=this._al+f|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+_|0,this._el=this._el+d|0,this._fl=this._fl+p|0,this._gl=this._gl+m|0,this._hl=this._hl+b|0,this._ah=this._ah+r+__getCarry_584(this._al,f)|0,this._bh=this._bh+i+__getCarry_584(this._bl,c)|0,this._ch=this._ch+n+__getCarry_584(this._cl,l)|0,this._dh=this._dh+o+__getCarry_584(this._dl,_)|0,this._eh=this._eh+a+__getCarry_584(this._el,d)|0,this._fh=this._fh+s+__getCarry_584(this._fl,p)|0,this._gh=this._gh+u+__getCarry_584(this._gl,m)|0,this._hh=this._hh+h+__getCarry_584(this._hl,b)|0},__Sha512_584.prototype._hash=function(){var t=__Buffer_584.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha512_584=__Sha512_584;var _$sha384_583={},__Buffer_583=_$safeBuffer_576.Buffer,__W_583=new Array(160);function __Sha384_583(){this.init(),this._w=__W_583,_$hash_577.call(this,128,112)}_$inherits_browser_530(__Sha384_583,_$sha512_584),__Sha384_583.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},__Sha384_583.prototype._hash=function(){var t=__Buffer_583.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+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},_$sha384_583=__Sha384_583;var _$shaJs_578={},__exports_578=_$shaJs_578=function(t){t=t.toLowerCase();var e=__exports_578[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};__exports_578.sha=_$sha_579,__exports_578.sha1=_$sha1_580,__exports_578.sha224=_$sha224_581,__exports_578.sha256=_$sha256_582,__exports_578.sha384=_$sha384_583,__exports_578.sha512=_$sha512_584;var _$cipherBase_461={},__Buffer_461=_$safeBuffer_576.Buffer,__Transform_461=_$Stream_585.Transform,__StringDecoder_461=_$string_decoder_586({}).StringDecoder;function __CipherBase_461(t){__Transform_461.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}_$inherits_browser_530(__CipherBase_461,__Transform_461),__CipherBase_461.prototype.update=function(t,e,r){"string"==typeof t&&(t=__Buffer_461.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},__CipherBase_461.prototype.setAutoPadding=function(){},__CipherBase_461.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},__CipherBase_461.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},__CipherBase_461.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},__CipherBase_461.prototype._transform=function(t,r,i){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(e){n=e}finally{i(n)}},__CipherBase_461.prototype._flush=function(t){var r;try{this.push(this.__final())}catch(e){r=e}t(r)},__CipherBase_461.prototype._finalOrDigest=function(t){var e=this.__final()||__Buffer_461.alloc(0);return t&&(e=this._toString(e,t,!0)),e},__CipherBase_461.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new __StringDecoder_461(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},_$cipherBase_461=__CipherBase_461;var _$browser_465={};function __Hash_465(t){_$cipherBase_461.call(this,"digest"),this._hash=t}_$inherits_browser_530(__Hash_465,_$cipherBase_461),__Hash_465.prototype._update=function(t){this._hash.update(t)},__Hash_465.prototype._final=function(){return this._hash.digest()},_$browser_465=function(t){return"md5"===(t=t.toLowerCase())?new _$md5Js_533:"rmd160"===t||"ripemd160"===t?new _$ripemd160_575:new __Hash_465(_$shaJs_578(t))};var _$legacy_468={},__Buffer_468=_$safeBuffer_576.Buffer,__ZEROS_468=__Buffer_468.alloc(128),__blocksize_468=64;function __Hmac_468(t,e){_$cipherBase_461.call(this,"digest"),"string"==typeof e&&(e=__Buffer_468.from(e)),this._alg=t,this._key=e,e.length>__blocksize_468?e=t(e):e.length<__blocksize_468&&(e=__Buffer_468.concat([e,__ZEROS_468],__blocksize_468));for(var r=this._ipad=__Buffer_468.allocUnsafe(__blocksize_468),i=this._opad=__Buffer_468.allocUnsafe(__blocksize_468),n=0;n<__blocksize_468;n++)r[n]=54^e[n],i[n]=92^e[n];this._hash=[r]}_$inherits_browser_530(__Hmac_468,_$cipherBase_461),__Hmac_468.prototype._update=function(t){this._hash.push(t)},__Hmac_468.prototype._final=function(){var t=this._alg(__Buffer_468.concat(this._hash));return this._alg(__Buffer_468.concat([this._opad,t]))},_$legacy_468=__Hmac_468;var _$md5_466=function(t){return(new _$md5Js_533).update(t).digest()},_$browser_467={},__Buffer_467=_$safeBuffer_576.Buffer,__ZEROS_467=__Buffer_467.alloc(128);function __Hmac_467(t,e){_$cipherBase_461.call(this,"digest"),"string"==typeof e&&(e=__Buffer_467.from(e));var r="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>r?e=("rmd160"===t?new _$ripemd160_575:_$shaJs_578(t)).update(e).digest():e.lengthMAX_ALLOC||e!=e)throw new TypeError("Bad key length")},_$defaultEncoding_545={};(function(t){var e;e=t.browser?"utf-8":t.version?parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",_$defaultEncoding_545=e}).call(this,_$browser_550);var __Buffer_548=_$safeBuffer_576.Buffer,_$toBuffer_548=function(t,e,r){if(__Buffer_548.isBuffer(t))return t;if("string"==typeof t)return __Buffer_548.from(t,e);if(ArrayBuffer.isView(t))return __Buffer_548.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},_$syncBrowser_547={},__Buffer_547=_$safeBuffer_576.Buffer,__ZEROS_547=__Buffer_547.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function __Hmac_547(t,e,r){var i=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new _$ripemd160_575).update(t).digest()}:"md5"===t?_$md5_466:function(e){return _$shaJs_578(t).update(e).digest()}}(t),n="sha512"===t||"sha384"===t?128:64;e.length>n?e=i(e):e.length>>0},writeUInt32BE:function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},ip:function(t,e,r,i){for(var n=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[i+0]=n>>>0,r[i+1]=o>>>0},rip:function(t,e,r,i){for(var n=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)n<<=1,n|=e>>>s+a&1,n<<=1,n|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},pc1:function(t,e,r,i){for(var n=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1}for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},r28shl:function(t,e){return t<>>28-e}},pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];_$utils_475.pc2=function(t,e,r,i){for(var n=0,o=0,a=pc2table.length>>>1,s=0;s>>pc2table[s]&1;for(s=a;s>>pc2table[s]&1;r[i+0]=n>>>0,r[i+1]=o>>>0},_$utils_475.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=t>>>o&63;for(o=11;o>=3;o-=4)n|=t>>>o&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];_$utils_475.substitute=function(t,e){for(var r=0,i=0;i<4;i++)r<<=4,r|=sTable[64*i+(t>>>18-6*i&63)];for(i=0;i<4;i++)r<<=4,r|=sTable[256+64*i+(e>>>18-6*i&63)];return r>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];_$utils_475.permute=function(t){for(var e=0,r=0;r>>permuteTable[r]&1;return e>>>0},_$utils_475.padSplit=function(t,e,r){for(var i=t.toString(2);i.length0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},__Cipher_472.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},__Cipher_472.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=_$utils_475.r28shl(r,o),i=_$utils_475.r28shl(i,o),_$utils_475.pc2(r,i,t.keys,n)}},DES.prototype._update=function(t,e,r,i){var n=this._desState,o=_$utils_475.readUInt32BE(t,e),a=_$utils_475.readUInt32BE(t,e+4);_$utils_475.ip(o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,a,n.tmp,0):this._decrypt(n,o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],_$utils_475.writeUInt32BE(r,o,i),_$utils_475.writeUInt32BE(r,a,i+4)},DES.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,o=c}_$utils_475.rip(a,o,i,n)},DES.prototype._decrypt=function(t,e,r,i,n){for(var o=r,a=e,s=t.keys.length-2;s>=0;s-=2){var u=t.keys[s],h=t.keys[s+1];_$utils_475.expand(o,t.tmp,0),u^=t.tmp[0],h^=t.tmp[1];var f=_$utils_475.substitute(u,h),c=o;o=(a^_$utils_475.permute(f))>>>0,a=c}_$utils_475.rip(o,a,i,n)};var _$cbc_471={},__proto_471={};function CBCState(t){this.iv=new Array(8);for(var e=0;e>o%8,t._prev=__shiftIn_425(t._prev,r?i:n);return a}function __shiftIn_425(t,e){var r=t.length,i=-1,n=__Buffer_425.allocUnsafe(t.length);for(t=__Buffer_425.concat([t,__Buffer_425.from([e])]);++i>7;return n}_$cfb1_425.encrypt=function(t,e,r){for(var i=e.length,n=__Buffer_425.allocUnsafe(i),o=-1;++o>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&m]^e[b++],a=h[d>>>24]^f[p>>>16&255]^c[m>>>8&255]^l[255&_]^e[b++],s=h[p>>>24]^f[m>>>16&255]^c[_>>>8&255]^l[255&d]^e[b++],u=h[m>>>24]^f[_>>>16&255]^c[d>>>8&255]^l[255&p]^e[b++],_=o,d=a,p=s,m=u;return o=(i[_>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[b++],a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&_])^e[b++],s=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[_>>>8&255]<<8|i[255&d])^e[b++],u=(i[m>>>24]<<24|i[_>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var __RCON_416=[0,1,2,4,8,16,32,64,128,27,54],__G_416=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[a]=h,i[h]=a;var f=t[a],c=t[f],l=t[c],_=257*t[h]^16843008*h;n[0][a]=_<<24|_>>>8,n[1][a]=_<<16|_>>>16,n[2][a]=_<<8|_>>>24,n[3][a]=_,_=16843009*l^65537*c^257*f^16843008*a,o[0][h]=_<<24|_>>>8,o[1][h]=_<<16|_>>>16,o[2][h]=_<<8|_>>>24,o[3][h]=_,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function __AES_416(t){this._key=__asUInt32Array_416(t),this._reset()}__AES_416.blockSize=16,__AES_416.keySize=32,__AES_416.prototype.blockSize=__AES_416.blockSize,__AES_416.prototype.keySize=__AES_416.keySize,__AES_416.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,a=__G_416.SBOX[a>>>24]<<24|__G_416.SBOX[a>>>16&255]<<16|__G_416.SBOX[a>>>8&255]<<8|__G_416.SBOX[255&a],a^=__RCON_416[o/e|0]<<24):e>6&&o%e==4&&(a=__G_416.SBOX[a>>>24]<<24|__G_416.SBOX[a>>>16&255]<<16|__G_416.SBOX[a>>>8&255]<<8|__G_416.SBOX[255&a]),n[o]=n[o-e]^a}for(var s=[],u=0;u>>24]]^__G_416.INV_SUB_MIX[1][__G_416.SBOX[f>>>16&255]]^__G_416.INV_SUB_MIX[2][__G_416.SBOX[f>>>8&255]]^__G_416.INV_SUB_MIX[3][__G_416.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},__AES_416.prototype.encryptBlockRaw=function(t){return __cryptBlock_416(t=__asUInt32Array_416(t),this._keySchedule,__G_416.SUB_MIX,__G_416.SBOX,this._nRounds)},__AES_416.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=__Buffer_416.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},__AES_416.prototype.decryptBlock=function(t){var e=(t=__asUInt32Array_416(t))[1];t[1]=t[3],t[3]=e;var r=__cryptBlock_416(t,this._invKeySchedule,__G_416.INV_SUB_MIX,__G_416.INV_SBOX,this._nRounds),i=__Buffer_416.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},__AES_416.prototype.scrub=function(){__scrubVec_416(this._keySchedule),__scrubVec_416(this._invKeySchedule),__scrubVec_416(this._key)},_$aes_416.AES=__AES_416;var _$ghash_421={},__Buffer_421=_$safeBuffer_576.Buffer,__ZEROES_421=__Buffer_421.alloc(16,0);function __fromArray_421(t){var e=__Buffer_421.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function __GHASH_421(t){this.h=t,this.state=__Buffer_421.alloc(16,0),this.cache=__Buffer_421.allocUnsafe(0)}__GHASH_421.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=__fromArray_421(n)},__GHASH_421.prototype.update=function(t){var e;for(this.cache=__Buffer_421.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},__GHASH_421.prototype.final=function(t,e){return this.cache.length&&this.ghash(__Buffer_421.concat([this.cache,__ZEROES_421],16)),this.ghash(__fromArray_421([0,t,0,e])),this.state},_$ghash_421=__GHASH_421;var _$authCipher_417={},__Buffer_417=_$safeBuffer_576.Buffer;function __StreamCipher_417(t,e,r,i){_$cipherBase_461.call(this);var n=__Buffer_417.alloc(4,0);this._cipher=new _$aes_416.AES(e);var o=this._cipher.encryptBlock(n);this._ghash=new _$ghash_421(o),r=function(t,e,r){if(12===e.length)return t._finID=__Buffer_417.concat([e,__Buffer_417.from([0,0,0,1])]),__Buffer_417.concat([e,__Buffer_417.from([0,0,0,2])]);var i=new _$ghash_421(r),n=e.length,o=n%16;i.update(e),o&&(o=16-o,i.update(__Buffer_417.alloc(o,0))),i.update(__Buffer_417.alloc(8,0));var a=8*n,s=__Buffer_417.alloc(8);s.writeUIntBE(a,0,8),i.update(s),t._finID=i.state;var u=__Buffer_417.from(t._finID);return _$incr32_422(u),u}(this,r,o),this._prev=__Buffer_417.from(r),this._cache=__Buffer_417.allocUnsafe(0),this._secCache=__Buffer_417.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}_$inherits_browser_530(__StreamCipher_417,_$cipherBase_461),__StreamCipher_417.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=__Buffer_417.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},__StreamCipher_417.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=_$bufferXor_459(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n0||i>0;){var u=new _$md5Js_533;u.update(s),u.update(t),e&&u.update(e),s=u.digest();var h=0;if(n>0){var f=o.length-n;h=Math.min(n,s.length),s.copy(o,f,0,h),n-=h}if(h0){var c=a.length-i,l=Math.min(i,s.length-h);s.copy(a,c,h,h+l),i-=l}}return s.fill(0),{key:o,iv:a}},_$encrypter_420={},__Buffer_420=_$safeBuffer_576.Buffer;function __Cipher_420(t,e,r){_$cipherBase_461.call(this),this._cache=new __Splitter_420,this._cipher=new _$aes_416.AES(e),this._prev=__Buffer_420.from(r),this._mode=t,this._autopadding=!0}_$inherits_browser_530(__Cipher_420,_$cipherBase_461),__Cipher_420.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return __Buffer_420.concat(i)};var __PADDING_420=__Buffer_420.alloc(16,16);function __Splitter_420(){this.cache=__Buffer_420.allocUnsafe(0)}function __createCipheriv_420(t,e,r){var i=_$modes_429[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=__Buffer_420.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=__Buffer_420.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new _$streamCipher_432(i.module,e,r):"auth"===i.type?new _$authCipher_417(i.module,e,r):new __Cipher_420(i.module,e,r)}__Cipher_420.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(__PADDING_420))throw this._cipher.scrub(),new Error("data not multiple of block length")},__Cipher_420.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},__Splitter_420.prototype.add=function(t){this.cache=__Buffer_420.concat([this.cache,t])},__Splitter_420.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},__Splitter_420.prototype.flush=function(){for(var t=16-this.cache.length,e=__Buffer_420.allocUnsafe(t),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},__Splitter_419.prototype.flush=function(){if(this.cache.length)return this.cache};var _$browser_418={};_$encrypter_420.createCipher,_$browser_418.createCipheriv=_$encrypter_420.createCipheriv,_$decrypter_419.createDecipher,_$browser_418.createDecipheriv=_$decrypter_419.createDecipheriv,_$browser_418.getCiphers=function(){return Object.keys(_$list_430)};var _$modes_435={"des-ecb":{key:8,iv:0}};_$modes_435["des-cbc"]=_$modes_435.des={key:8,iv:8},_$modes_435["des-ede3-cbc"]=_$modes_435.des3={key:24,iv:8},_$modes_435["des-ede3"]={key:24,iv:0},_$modes_435["des-ede-cbc"]={key:16,iv:8},_$modes_435["des-ede"]={key:16,iv:0};var _$browser_433={};function __createCipheriv_433(t,e,r){if(t=t.toLowerCase(),_$modes_429[t])return _$browser_418.createCipheriv(t,e,r);if(_$modes_435[t])return new _$browserifyDes_434({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function __createDecipheriv_433(t,e,r){if(t=t.toLowerCase(),_$modes_429[t])return _$browser_418.createDecipheriv(t,e,r);if(_$modes_435[t])return new _$browserifyDes_434({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}_$browser_433.createCipher=_$browser_433.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),_$modes_429[t])r=_$modes_429[t].key,i=_$modes_429[t].iv;else{if(!_$modes_435[t])throw new TypeError("invalid suite type");r=8*_$modes_435[t].key,i=_$modes_435[t].iv}var n=_$evp_bytestokey_499(e,!1,r,i);return __createCipheriv_433(t,n.key,n.iv)},_$browser_433.createCipheriv=_$browser_433.Cipheriv=__createCipheriv_433,_$browser_433.createDecipher=_$browser_433.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),_$modes_429[t])r=_$modes_429[t].key,i=_$modes_429[t].iv;else{if(!_$modes_435[t])throw new TypeError("invalid suite type");r=8*_$modes_435[t].key,i=_$modes_435[t].iv}var n=_$evp_bytestokey_499(e,!1,r,i);return __createDecipheriv_433(t,n.key,n.iv)},_$browser_433.createDecipheriv=_$browser_433.Decipheriv=__createDecipheriv_433,_$browser_433.listCiphers=_$browser_433.getCiphers=function(){return Object.keys(_$modes_435).concat(_$browser_418.getCiphers())};var _$bn_480={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_480,this),_$bn_480=_$bn_480.exports;var _$bn_535={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_535,this),_$bn_535=_$bn_535.exports;var _$brorand_414={},__r_414;function __Rand_414(t){this.rand=t}if(_$brorand_414=function(t){return __r_414||(__r_414=new __Rand_414(null)),__r_414.generate(t)},_$brorand_414.Rand=__Rand_414,__Rand_414.prototype.generate=function(t){return this._rand(t)},__Rand_414.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r=0);return i},MillerRabin.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},MillerRabin.prototype.test=function(t,e,r){var i=t.bitLength(),n=_$bn_535.mont(t),o=new _$bn_535(1).toRed(n);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),h=a.toRed(n);e>0;e--){var f=this._randrange(new _$bn_535(2),a);r&&r(f);var c=f.toRed(n).redPow(u);if(0!==c.cmp(o)&&0!==c.cmp(h)){for(var l=1;l0;e--){var h=this._randrange(new _$bn_535(2),o),f=t.gcd(h);if(0!==f.cmpn(1))return f;var c=h.toRed(i).redPow(s);if(0!==c.cmp(n)&&0!==c.cmp(u)){for(var l=1;lt;)r.ishrn(1);if(r.isEven()&&r.iadd(__ONE_478),r.testn(1)||r.iadd(TWO),e.cmp(TWO)){if(!e.cmp(FIVE))for(;r.mod(TEN).cmp(__THREE_478);)r.iadd(FOUR)}else for(;r.mod(TWENTYFOUR).cmp(ELEVEN);)r.iadd(FOUR);if(simpleSieve(i=r.shrn(1))&&simpleSieve(r)&&fermatTest(i)&&fermatTest(r)&&millerRabin.test(i)&&millerRabin.test(r))return r}}var _$primes_479={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},_$DH_477={};(function(t){var e=new _$mr_534,r=new _$bn_480(24),i=new _$bn_480(11),n=new _$bn_480(10),o=new _$bn_480(3),a=new _$bn_480(7);function s(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._pub=new _$bn_480(e),this}function u(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._priv=new _$bn_480(e),this}_$DH_477=f;var h={};function f(t,e,r){this.setGenerator(e),this.__prime=new _$bn_480(t),this._prime=_$bn_480.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=s,this.setPrivateKey=u):this._primeCode=8}function c(e,r){var i=new t(e.toArray());return r?i.toString(r):i}Object.defineProperty(f.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,s){var u=s.toString("hex"),f=[u,t.toString(16)].join("_");if(f in h)return h[f];var c,l=0;if(t.isEven()||!_$generatePrime_478.simpleSieve||!_$generatePrime_478.fermatTest(t)||!e.test(t))return l+=1,l+="02"===u||"05"===u?8:4,h[f]=l,l;switch(e.test(t.shrn(1))||(l+=2),u){case"02":t.mod(r).cmp(i)&&(l+=8);break;case"05":(c=t.mod(n)).cmp(o)&&c.cmp(a)&&(l+=8);break;default:l+=4}return h[f]=l,l}(this.__prime,this.__gen)),this._primeCode}}),f.prototype.generateKeys=function(){return this._priv||(this._priv=new _$bn_480(_$browser_558(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},f.prototype.computeSecret=function(e){var r=(e=(e=new _$bn_480(e)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new t(r.toArray()),n=this.getPrime();if(i.length0?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 __Buffer_451.alloc(0);for(var e,r,i,n=__Buffer_451.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_451.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_451.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:__custom_451,value:function(t,e){return __inspect_451(this,function(t){for(var e=1;e2?"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))}__createErrorType_444("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),__createErrorType_444("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(__oneOf_444(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(__oneOf_444(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),__createErrorType_444("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),__createErrorType_444("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),__createErrorType_444("ERR_STREAM_PREMATURE_CLOSE","Premature close"),__createErrorType_444("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),__createErrorType_444("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),__createErrorType_444("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),__createErrorType_444("ERR_STREAM_WRITE_AFTER_END","write after end"),__createErrorType_444("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),__createErrorType_444("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),__createErrorType_444("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_444.codes=__codes_444;var __ERR_INVALID_OPT_VALUE_456=_$errorsBrowser_444.codes.ERR_INVALID_OPT_VALUE,_$state_456={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new __ERR_INVALID_OPT_VALUE_456(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$Transform_448=__Transform_448,___require$codes_448=_$errorsBrowser_444.codes,__ERR_METHOD_NOT_IMPLEMENTED_448=___require$codes_448.ERR_METHOD_NOT_IMPLEMENTED,__ERR_MULTIPLE_CALLBACK_448=___require$codes_448.ERR_MULTIPLE_CALLBACK,__ERR_TRANSFORM_ALREADY_TRANSFORMING_448=___require$codes_448.ERR_TRANSFORM_ALREADY_TRANSFORMING,__ERR_TRANSFORM_WITH_LENGTH_0_448=___require$codes_448.ERR_TRANSFORM_WITH_LENGTH_0,__Duplex_448=_$Duplex_445({});function __afterTransform_448(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new __ERR_MULTIPLE_CALLBACK_448);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(__call_455),a||(o.forEach(__call_455),n(i))}))}));return e.reduce(__pipe_455)},_$readableBrowser_458={};_$readableBrowser_458=_$readableBrowser_458=_$_stream_readable_447({}),_$readableBrowser_458.Stream=_$readableBrowser_458,_$readableBrowser_458.Readable=_$readableBrowser_458,_$readableBrowser_458.Writable=_$_stream_writable_449({}),_$readableBrowser_458.Duplex=_$Duplex_445({}),_$readableBrowser_458.Transform=_$Transform_448,_$readableBrowser_458.PassThrough=_$PassThrough_446,_$readableBrowser_458.finished=_$eos_453({}),_$readableBrowser_458.pipeline=_$pipeline_455;var _$bn_437={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_437,this),_$bn_437=_$bn_437.exports;var _$browserifyRsa_436={};(function(t){function e(e,i){var n=function(t){var e=r(t);return{blinder:e.toRed(_$bn_437.mont(t.modulus)).redPow(new _$bn_437(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(i),o=i.modulus.byteLength(),a=(_$bn_437.mont(i.modulus),new _$bn_437(e).mul(n.blinder).umod(i.modulus)),s=a.toRed(_$bn_437.mont(i.prime1)),u=a.toRed(_$bn_437.mont(i.prime2)),h=i.coefficient,f=i.prime1,c=i.prime2,l=s.redPow(i.exponent1),_=u.redPow(i.exponent2);l=l.fromRed(),_=_.fromRed();var d=l.isub(_).imul(h).umod(f);return d.imul(c),_.iadd(d),new t(_.imul(n.unblinder).umod(i.modulus).toArray(!1,o))}function r(t){for(var e=t.modulus.byteLength(),r=new _$bn_437(_$browser_558(e));r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new _$bn_437(_$browser_558(e));return r}_$browserifyRsa_436=e,e.getr=r}).call(this,_$buffer_460({}).Buffer);var _$package_497={version:"6.5.3"},_$bn_496={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_496,this),_$bn_496=_$bn_496.exports;var _$utils_537={},__utils_537=_$utils_537;function __zero2_537(t){return 1===t.length?"0"+t:t}function __toHex_537(t){for(var e="",r=0;r>8,a=255&n;o?r.push(o,a):r.push(a)}return r},__utils_537.zero2=__zero2_537,__utils_537.toHex=__toHex_537,__utils_537.encode=function(t,e){return"hex"===e?__toHex_537(t):t};var _$utils_495={},__utils_495=_$utils_495;__utils_495.assert=_$minimalisticAssert_536,__utils_495.toArray=_$utils_537.toArray,__utils_495.zero2=_$utils_537.zero2,__utils_495.toHex=_$utils_537.toHex,__utils_495.encode=_$utils_537.encode,__utils_495.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?(n>>1)-u:u,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},__utils_495.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0;t.cmpn(-i)>0||e.cmpn(-n)>0;){var o,a,s,u=t.andln(3)+i&3,h=e.andln(3)+n&3;3===u&&(u=-1),3===h&&(h=-1),o=0==(1&u)?0:3!=(s=t.andln(7)+i&7)&&5!==s||2!==h?u:-u,r[0].push(o),a=0==(1&h)?0:3!=(s=e.andln(7)+n&7)&&5!==s||2!==u?h:-h,r[1].push(a),2*i===o+1&&(i=1-i),2*n===a+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r},__utils_495.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},__utils_495.parseBytes=function(t){return"string"==typeof t?__utils_495.toArray(t,"hex"):t},__utils_495.intFromLE=function(t){return new _$bn_496(t,"hex","le")};var _$base_482={},__getNAF_482=_$utils_495.getNAF,__getJSF_482=_$utils_495.getJSF;function __BaseCurve_482(t,e){this.type=t,this.p=new _$bn_496(e.p,16),this.red=e.prime?_$bn_496.red(e.prime):_$bn_496.mont(this.p),this.zero=new _$bn_496(0).toRed(this.red),this.one=new _$bn_496(1).toRed(this.red),this.two=new _$bn_496(2).toRed(this.red),this.n=e.n&&new _$bn_496(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 __BasePoint_482(t,e){this.curve=t,this.type=e,this.precomputed=null}_$utils_495.assert,_$base_482=__BaseCurve_482,__BaseCurve_482.prototype.point=function(){throw new Error("Not implemented")},__BaseCurve_482.prototype.validate=function(){throw new Error("Not implemented")},__BaseCurve_482.prototype._fixedNafMul=function(t,e){var r=t._getDoubles(),i=__getNAF_482(e,1,this._bitLength),n=(1<=a;e--)s=(s<<1)+i[e];o.push(s)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=n;f>0;f--){for(a=0;a=0;s--){for(e=0;s>=0&&0===o[s];s--)e++;if(s>=0&&e++,a=a.dblp(e),s<0)break;var u=o[s];a="affine"===t.type?u>0?a.mixedAdd(n[u-1>>1]):a.mixedAdd(n[-u-1>>1].neg()):u>0?a.add(n[u-1>>1]):a.add(n[-u-1>>1].neg())}return"affine"===t.type?a.toP():a},__BaseCurve_482.prototype._wnafMulAdd=function(t,e,r,i,n){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,h=0;h=1;h-=2){var c=h-1,l=h;if(1===o[c]&&1===o[l]){var _=[e[c],null,null,e[l]];0===e[c].y.cmp(e[l].y)?(_[1]=e[c].add(e[l]),_[2]=e[c].toJ().mixedAdd(e[l].neg())):0===e[c].y.cmp(e[l].y.redNeg())?(_[1]=e[c].toJ().mixedAdd(e[l]),_[2]=e[c].add(e[l].neg())):(_[1]=e[c].toJ().mixedAdd(e[l]),_[2]=e[c].toJ().mixedAdd(e[l].neg()));var d=[-3,-1,-5,-7,0,7,5,1,3],p=__getJSF_482(r[c],r[l]);u=Math.max(p[0].length,u),s[c]=new Array(u),s[l]=new Array(u);for(var m=0;m=0;h--){for(var w=0;h>=0;){var M=!0;for(m=0;m=0&&w++,v=v.dblp(w),h<0)break;for(m=0;m0?S=a[m][$-1>>1]:$<0&&(S=a[m][-$-1>>1].neg()),v="affine"===S.type?v.mixedAdd(S):v.add(S))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},__BasePoint_482.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n=0&&(o=e,a=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:n},{a:o,b:a}]},__ShortCurve_486.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),h=o.mul(i.b);return{k1:t.sub(a).sub(s),k2:u.add(h).neg()}},__ShortCurve_486.prototype.pointFromX=function(t,e){(t=new _$bn_496(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},__ShortCurve_486.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},__ShortCurve_486.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},__Point_486.prototype.isInfinity=function(){return this.inf},__Point_486.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},__Point_486.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},__Point_486.prototype.getX=function(){return this.x.fromRed()},__Point_486.prototype.getY=function(){return this.y.fromRed()},__Point_486.prototype.mul=function(t){return t=new _$bn_496(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)},__Point_486.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},__Point_486.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},__Point_486.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))},__Point_486.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},__Point_486.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},_$inherits_browser_530(__JPoint_486,_$base_482.BasePoint),__ShortCurve_486.prototype.jpoint=function(t,e,r){return new __JPoint_486(this,t,e,r)},__JPoint_486.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},__JPoint_486.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},__JPoint_486.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),_=u.redMul(c.redISub(l)).redISub(o.redMul(f)),d=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,_,d)},__JPoint_486.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),_=this.z.redMul(a);return this.curve.jpoint(c,l,_)},__JPoint_486.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(n),0===this.x.cmp(r))return!0}},__JPoint_486.prototype.inspect=function(){return this.isInfinity()?"":""},__JPoint_486.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _$mont_485={};function __MontCurve_485(t){_$base_482.call(this,"mont",t),this.a=new _$bn_496(t.a,16).toRed(this.red),this.b=new _$bn_496(t.b,16).toRed(this.red),this.i4=new _$bn_496(4).toRed(this.red).redInvm(),this.two=new _$bn_496(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function __Point_485(t,e,r){_$base_482.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _$bn_496(e,16),this.z=new _$bn_496(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}_$inherits_browser_530(__MontCurve_485,_$base_482),_$mont_485=__MontCurve_485,__MontCurve_485.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},_$inherits_browser_530(__Point_485,_$base_482.BasePoint),__MontCurve_485.prototype.decodePoint=function(t,e){return this.point(_$utils_495.toArray(t,e),1)},__MontCurve_485.prototype.point=function(t,e){return new __Point_485(this,t,e)},__MontCurve_485.prototype.pointFromJSON=function(t){return __Point_485.fromJSON(this,t)},__Point_485.prototype.precompute=function(){},__Point_485.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},__Point_485.fromJSON=function(t,e){return new __Point_485(t,e[0],e[1]||t.one)},__Point_485.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_485.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},__Point_485.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},__Point_485.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},__Point_485.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=n.redMul(i),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},__Point_485.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},__Point_485.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_485.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_485.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},__Point_485.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},__Point_485.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var _$edwards_483={};function __EdwardsCurve_483(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,_$base_482.call(this,"edwards",t),this.a=new _$bn_496(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _$bn_496(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _$bn_496(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),this.oneC=1==(0|t.c)}function __Point_483(t,e,r,i,n){_$base_482.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new _$bn_496(e,16),this.y=new _$bn_496(r,16),this.z=i?new _$bn_496(i,16):this.curve.one,this.t=n&&new _$bn_496(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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}_$utils_495.assert,_$inherits_browser_530(__EdwardsCurve_483,_$base_482),_$edwards_483=__EdwardsCurve_483,__EdwardsCurve_483.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},__EdwardsCurve_483.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},__EdwardsCurve_483.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},__EdwardsCurve_483.prototype.pointFromX=function(t,e){(t=new _$bn_496(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},__EdwardsCurve_483.prototype.pointFromY=function(t,e){(t=new _$bn_496(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(n.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},__EdwardsCurve_483.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},_$inherits_browser_530(__Point_483,_$base_482.BasePoint),__EdwardsCurve_483.prototype.pointFromJSON=function(t){return __Point_483.fromJSON(this,t)},__EdwardsCurve_483.prototype.point=function(t,e,r,i){return new __Point_483(this,t,e,r,i)},__Point_483.fromJSON=function(t,e){return new __Point_483(t,e[0],e[1],e[2])},__Point_483.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_483.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},__Point_483.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),a=o.redSub(r),s=i.redSub(e),u=n.redMul(a),h=o.redMul(s),f=n.redMul(s),c=a.redMul(o);return this.curve.point(u,h,c,f)},__Point_483.prototype._projDbl=function(){var t,e,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(h=this.curve._mulA(n)).redAdd(o);if(this.zOne)t=i.redSub(n).redSub(o).redMul(a.redSub(this.curve.two)),e=a.redMul(h.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);t=i.redSub(n).redISub(o).redMul(u),e=a.redMul(h.redSub(o)),r=a.redMul(u)}}else{var h=n.redAdd(o);s=this.curve._mulC(this.z).redSqr(),u=h.redSub(s).redSub(s),t=this.curve._mulC(i.redISub(h)).redMul(u),e=this.curve._mulC(h).redMul(n.redISub(o)),r=h.redMul(u)}return this.curve.point(t,e,r)},__Point_483.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},__Point_483.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=o.redMul(a),f=s.redMul(u),c=o.redMul(u),l=a.redMul(s);return this.curve.point(h,f,l,c)},__Point_483.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=i.redMul(h).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},__Point_483.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},__Point_483.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},__Point_483.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},__Point_483.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},__Point_483.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},__Point_483.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},__Point_483.prototype.getX=function(){return this.normalize(),this.x.fromRed()},__Point_483.prototype.getY=function(){return this.normalize(),this.y.fromRed()},__Point_483.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},__Point_483.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},__Point_483.prototype.toP=__Point_483.prototype.normalize,__Point_483.prototype.mixedAdd=__Point_483.prototype.add;var _$curve_484={},__curve_484=_$curve_484;__curve_484.base=_$base_482,__curve_484.short=_$short_486,__curve_484.mont=_$mont_485,__curve_484.edwards=_$edwards_483;var _$utils_527={};function __isSurrogatePair_527(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function __htonl_527(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function __zero2_527(t){return 1===t.length?"0"+t:t}function __zero8_527(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}_$utils_527.inherits=_$inherits_browser_530,_$utils_527.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):__isSurrogatePair_527(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return n},_$utils_527.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},_$utils_527.rotr32=function(t,e){return t>>>e|t<<32-e},_$utils_527.rotl32=function(t,e){return t<>>32-e},_$utils_527.sum32=function(t,e){return t+e>>>0},_$utils_527.sum32_3=function(t,e,r){return t+e+r>>>0},_$utils_527.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},_$utils_527.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},_$utils_527.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},_$utils_527.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},_$utils_527.sum64_lo=function(t,e,r,i){return e+i>>>0},_$utils_527.sum64_4_hi=function(t,e,r,i,n,o,a,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},_$utils_527.sum64_4_lo=function(t,e,r,i,n,o,a,s){return e+i+o+s>>>0},_$utils_527.sum64_5_hi=function(t,e,r,i,n,o,a,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},_$utils_527.sum64_5_lo=function(t,e,r,i,n,o,a,s,u,h){return e+i+o+s+h>>>0},_$utils_527.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},_$utils_527.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},_$utils_527.shr64_hi=function(t,e,r){return t>>>r},_$utils_527.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var _$common_517={};function __BlockHash_517(){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}_$common_517.BlockHash=__BlockHash_517,__BlockHash_517.prototype.update=function(t,e){if(t=_$utils_527.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=_$utils_527.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o>>3},_$common_526.g1_256=function(t){return __rotr32_526(t,17)^__rotr32_526(t,19)^t>>>10};var _$1_521={},__rotl32_521=_$utils_527.rotl32,__sum32_521=_$utils_527.sum32,__sum32_5_521=_$utils_527.sum32_5,__ft_1_521=_$common_526.ft_1,__BlockHash_521=_$common_517.BlockHash,__sha1_K_521=[1518500249,1859775393,2400959708,3395469782];function __SHA1_521(){if(!(this instanceof __SHA1_521))return new __SHA1_521;__BlockHash_521.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}_$utils_527.inherits(__SHA1_521,__BlockHash_521),_$1_521=__SHA1_521,__SHA1_521.blockSize=512,__SHA1_521.outSize=160,__SHA1_521.hmacStrength=80,__SHA1_521.padLength=64,__SHA1_521.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest());for(var e=t.length;ethis.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=_$utils_537.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length"};var _$signature_490={};function __Signature_490(t,e){if(t instanceof __Signature_490)return t;this._importDER(t,e)||(this.r=new _$bn_496(t.r,16),this.s=new _$bn_496(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function __Position_490(){this.place=0}function __getLength_490(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,a=e.place;o>>=0;return!(n<=127)&&(e.place=a,n)}function __rmPadding_490(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)}}_$utils_495.assert,_$signature_490=__Signature_490,__Signature_490.prototype._importDER=function(t,e){t=_$utils_495.toArray(t,e);var r=new __Position_490;if(48!==t[r.place++])return!1;var i=__getLength_490(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=__getLength_490(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=__getLength_490(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new _$bn_496(o),this.s=new _$bn_496(s),this.recoveryParam=null,!0},__Signature_490.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=__rmPadding_490(e),r=__rmPadding_490(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];__constructLength_490(i,e.length),(i=i.concat(e)).push(2),__constructLength_490(i,r.length);var n=i.concat(r),o=[48];return __constructLength_490(o,n.length),o=o.concat(n),_$utils_495.encode(o,t)};var _$ec_488={},__KeyPair_488=(_$utils_495.assert,_$key_489);function __EC_488(t){if(!(this instanceof __EC_488))return new __EC_488(t);"string"==typeof t&&(t=_$curves_487[t]),t instanceof _$curves_487.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}_$ec_488=__EC_488,__EC_488.prototype.keyPair=function(t){return new __KeyPair_488(this,t)},__EC_488.prototype.keyFromPrivate=function(t,e){return __KeyPair_488.fromPrivate(this,t,e)},__EC_488.prototype.keyFromPublic=function(t,e){return __KeyPair_488.fromPublic(this,t,e)},__EC_488.prototype.genKeyPair=function(t){t||(t={});for(var e=new _$hmacDrbg_528({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_$brorand_414(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _$bn_496(2));;){var n=new _$bn_496(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},__EC_488.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},__EC_488.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new _$bn_496(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),a=t.toArray("be",n),s=new _$hmacDrbg_528({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new _$bn_496(1)),h=0;;h++){var f=i.k?i.k(h):new _$bn_496(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var c=this.g.mul(f);if(!c.isInfinity()){var l=c.getX(),_=l.umod(this.n);if(0!==_.cmpn(0)){var d=f.invm(this.n).mul(_.mul(e.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var p=(c.getY().isOdd()?1:0)|(0!==l.cmp(_)?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),p^=1),new _$signature_490({r:_,s:d,recoveryParam:p})}}}}}},__EC_488.prototype.verify=function(t,e,r,i){t=this._truncateToN(new _$bn_496(t,16)),r=this.keyFromPublic(r,i);var n=(e=new _$signature_490(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),h=s.mul(n).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(n):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(n)},__EC_488.prototype.recoverPubKey=function(t,e,r,i){e=new _$signature_490(e,i);var n=this.n,o=new _$bn_496(t),a=e.r,s=e.s,u=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=e.r.invm(n),c=n.sub(o).mul(f).umod(n),l=s.mul(f).umod(n);return this.g.mulAdd(c,a,l)},__EC_488.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new _$signature_490(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var _$key_492={},__parseBytes_492=(_$utils_495.assert,_$utils_495.parseBytes),__cachedProperty_492=_$utils_495.cachedProperty;function __KeyPair_492(t,e){this.eddsa=t,this._secret=__parseBytes_492(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=__parseBytes_492(e.pub)}__KeyPair_492.fromPublic=function(t,e){return e instanceof __KeyPair_492?e:new __KeyPair_492(t,{pub:e})},__KeyPair_492.fromSecret=function(t,e){return e instanceof __KeyPair_492?e:new __KeyPair_492(t,{secret:e})},__KeyPair_492.prototype.secret=function(){return this._secret},__cachedProperty_492(__KeyPair_492,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),__cachedProperty_492(__KeyPair_492,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),__cachedProperty_492(__KeyPair_492,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),__cachedProperty_492(__KeyPair_492,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),__cachedProperty_492(__KeyPair_492,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),__cachedProperty_492(__KeyPair_492,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),__KeyPair_492.prototype.sign=function(t){return this.eddsa.sign(t,this)},__KeyPair_492.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},__KeyPair_492.prototype.getSecret=function(t){return _$utils_495.encode(this.secret(),t)},__KeyPair_492.prototype.getPublic=function(t){return _$utils_495.encode(this.pubBytes(),t)},_$key_492=__KeyPair_492;var _$signature_493={},__cachedProperty_493=(_$utils_495.assert,_$utils_495.cachedProperty),__parseBytes_493=_$utils_495.parseBytes;function __Signature_493(t,e){this.eddsa=t,"object"!=typeof e&&(e=__parseBytes_493(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof _$bn_496&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}__cachedProperty_493(__Signature_493,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),__cachedProperty_493(__Signature_493,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),__cachedProperty_493(__Signature_493,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),__cachedProperty_493(__Signature_493,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),__Signature_493.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},__Signature_493.prototype.toHex=function(){return _$utils_495.encode(this.toBytes(),"hex").toUpperCase()},_$signature_493=__Signature_493;var _$eddsa_491={},__parseBytes_491=(_$utils_495.assert,_$utils_495.parseBytes);function __EDDSA_491(t){if(!(this instanceof __EDDSA_491))return new __EDDSA_491(t);t=_$curves_487[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=_$hash_516.sha512}_$eddsa_491=__EDDSA_491,__EDDSA_491.prototype.sign=function(t,e){t=__parseBytes_491(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:o})},__EDDSA_491.prototype.verify=function(t,e,r){t=__parseBytes_491(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},__EDDSA_491.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}function h(){return(this.red?""}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this._strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?n.prototype[Symbol.for("nodejs.util.inspect.custom")]=h:n.prototype.inspect=h;var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function _(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?f[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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=c[t],h=l[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modrn(h).toString(t);r=(_=_.idivn(h)).isZero()?d+r:f[u-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),n=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,r||Math.max(1,i));return this["_toArrayLike"+("le"===e?"LE":"BE")](n,i),n},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),i=0,o=0):(i=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),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function m(t,e,r){return p(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(d=_),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?_(this,t,e):r<1024?p(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},b.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this._strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return e?-i:i},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new $(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function $(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function E(t){$.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},$.prototype._verify1=function(t){},$.prototype._verify2=function(t,e){},$.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},$.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},$.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)},$.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},$.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)},$.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},$.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},$.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},$.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},$.prototype.isqr=function(t){return this.imul(t,t.clone())},$.prototype.sqr=function(t){return this.mul(t,t)},$.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},$.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},$.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},$.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},$.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new E(t)},i(E,$),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_413,this),_$bn_413=_$bn_413.exports;var _$bn_411={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o=_$empty_415({}).Buffer}catch(e){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_411,this),_$bn_411=_$bn_411.exports;var _$reporter_402={};function Reporter(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function ReporterError(t,e){this.path=t,this.rethrow(e)}_$reporter_402.Reporter=Reporter,Reporter.prototype.isError=function(t){return t instanceof ReporterError},Reporter.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},Reporter.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},Reporter.prototype.enterKey=function(t){return this._reporterState.path.push(t)},Reporter.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},Reporter.prototype.leaveKey=function(t,e,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},Reporter.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},Reporter.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof ReporterError;if(e=i?t:new ReporterError(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},Reporter.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},_$inherits_browser_530(ReporterError,Error),ReporterError.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var asn=_$asn1_397({}),Time=asn.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),AttributeTypeValue=asn.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),AlgorithmIdentifier=asn.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())})),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",(function(){this.setof(AttributeTypeValue)})),RDNSequence=asn.define("RDNSequence",(function(){this.seqof(RelativeDistinguishedName)})),Name=asn.define("Name",(function(){this.choice({rdnSequence:this.use(RDNSequence)})})),Validity=asn.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))})),Extension=asn.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),TBSCertificate=asn.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())})),X509Certificate=asn.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier),this.key("signatureValue").bitstr())})),_$X509Certificate_540=X509Certificate,_$asn1_539={},__asn1_539=_$asn1_397({});_$asn1_539.certificate=_$X509Certificate_540;var RSAPrivateKey=__asn1_539.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));_$asn1_539.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=__asn1_539.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));_$asn1_539.RSAPublicKey=RSAPublicKey;var PublicKey=__asn1_539.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(__AlgorithmIdentifier_539),this.key("subjectPublicKey").bitstr())}));_$asn1_539.PublicKey=PublicKey;var __AlgorithmIdentifier_539=__asn1_539.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),PrivateKeyInfo=__asn1_539.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(__AlgorithmIdentifier_539),this.key("subjectPrivateKey").octstr())}));_$asn1_539.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=__asn1_539.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));_$asn1_539.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=__asn1_539.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));_$asn1_539.DSAPrivateKey=DSAPrivateKey,_$asn1_539.DSAparam=__asn1_539.define("DSAparam",(function(){this.int()}));var ECPrivateKey=__asn1_539.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())}));_$asn1_539.ECPrivateKey=ECPrivateKey;var ECParameters=__asn1_539.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));_$asn1_539.signature=__asn1_539.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}));var _$aesid_538={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,__Buffer_541=_$safeBuffer_576.Buffer,_$fixProc_541=function(t,e){var r,i=t.toString(),n=i.match(findProc);if(n){var o="aes"+n[1],a=__Buffer_541.from(n[2],"hex"),s=__Buffer_541.from(n[3].replace(/[\r\n]/g,""),"base64"),u=_$evp_bytestokey_499(e,a.slice(0,8),parseInt(n[1],10)).key,h=[],f=_$browser_418.createDecipheriv(o,u,a);h.push(f.update(s)),h.push(f.final()),r=__Buffer_541.concat(h)}else{var c=i.match(fullRegex);r=new __Buffer_541(c[2].replace(/[\r\n]/g,""),"base64")}return{tag:i.match(startRegex)[1],data:r}},_$parseAsn1_542={},__Buffer_542=_$safeBuffer_576.Buffer;function __parseKeys_542(t){var e;"object"!=typeof t||__Buffer_542.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=__Buffer_542.from(t));var r,i,n=_$fixProc_541(t,e),o=n.tag,a=n.data;switch(o){case"CERTIFICATE":i=_$asn1_539.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(i||(i=_$asn1_539.PublicKey.decode(a,"der")),r=i.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return _$asn1_539.RSAPublicKey.decode(i.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return i.subjectPrivateKey=i.subjectPublicKey,{type:"ec",data:i};case"1.2.840.10040.4.1":return i.algorithm.params.pub_key=_$asn1_539.DSAparam.decode(i.subjectPublicKey.data,"der"),{type:"dsa",data:i.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"ENCRYPTED PRIVATE KEY":a=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=_$aesid_538[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,a=t.subjectPrivateKey,s=parseInt(n.split("-")[1],10)/8,u=_$browser_543.pbkdf2Sync(e,r,i,s,"sha1"),h=_$browser_418.createDecipheriv(n,u,o),f=[];return f.push(h.update(a)),f.push(h.final()),__Buffer_542.concat(f)}(a=_$asn1_539.EncryptedPrivateKey.decode(a,"der"),e);case"PRIVATE KEY":switch(r=(i=_$asn1_539.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return _$asn1_539.RSAPrivateKey.decode(i.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:i.algorithm.curve,privateKey:_$asn1_539.ECPrivateKey.decode(i.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return i.algorithm.params.priv_key=_$asn1_539.DSAparam.decode(i.subjectPrivateKey,"der"),{type:"dsa",params:i.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"RSA PUBLIC KEY":return _$asn1_539.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return _$asn1_539.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:_$asn1_539.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=_$asn1_539.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}_$parseAsn1_542=__parseKeys_542,__parseKeys_542.signature=_$asn1_539.signature;var _$curves_440={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},_$sign_442={},__Buffer_442=_$safeBuffer_576.Buffer,__EC_442=_$elliptic_481.ec;function getKey(t,e,r,i){if((t=__Buffer_442.from(t.toArray())).length0&&r.ishrn(i),r}function makeKey(t,e,r){var i,n;do{for(i=__Buffer_442.alloc(0);8*i.length=e)throw new Error("invalid sig")}var _$verify_443=function(t,e,r,i,n){var o=_$parseAsn1_542(r);if("ec"===o.type){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong public key type");return function(t,e,r){var i=_$curves_440[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new __EC_443(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,o)}if("dsa"===o.type){if("dsa"!==i)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,n=r.data.q,o=r.data.g,a=r.data.pub_key,s=_$parseAsn1_542.signature.decode(t,"der"),u=s.s,h=s.r;checkValue(u,n),checkValue(h,n);var f=_$bn_413.mont(i),c=u.invm(n);return 0===o.toRed(f).redPow(new _$bn_413(e).mul(c).mod(n)).fromRed().mul(a.toRed(f).redPow(h.mul(c).mod(n)).fromRed()).mod(i).mod(n).cmp(h)}(t,e,o)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong public key type");e=__Buffer_443.concat([n,e]);for(var a=o.modulus.byteLength(),s=[1],u=0;e.length+s.length+2=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_464,this),_$bn_464=_$bn_464.exports;var _$browser_463={};(function(t){_$browser_463=function(t){return new r(t)};var e={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function r(t){this.curveType=e[t],this.curveType||(this.curveType={name:t}),this.curve=new _$elliptic_481.ec(this.curveType.name),this.keys=void 0}function i(e,r,i){Array.isArray(e)||(e=e.toArray());var n=new t(e);if(i&&n.length=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.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);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},n.prototype._initArray=function(t,e,r){if(t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<>>26-o&4194303),this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),_=Math.max(0,h-t.length+1);_<=l;_++){var d=h-_|0;f+=(a=(n=0|t.words[d])*(o=0|e.words[_])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.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 c=h[t],l=f[t];r="";var _=this.clone();for(_.negative=0;!_.isZero();){var d=_.modn(l).toString(t);r=(_=_.idivn(l)).isZero()?d+r:u[c-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.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,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=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},n.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},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.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)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){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()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){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,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var 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,_=0|a[1],d=8191&_,p=_>>>13,m=0|a[2],b=8191&m,g=m>>>13,v=0|a[3],y=8191&v,w=v>>>13,M=0|a[4],S=8191&M,$=M>>>13,E=0|a[5],k=8191&E,A=E>>>13,B=0|a[6],x=8191&B,T=B>>>13,R=0|a[7],P=8191&R,I=R>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],U=8191&L,D=L>>>13,z=0|s[0],j=8191&z,H=z>>>13,q=0|s[1],F=8191&q,K=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],Y=8191&Z,J=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,_t=0|s[9],dt=8191&_t,pt=_t>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,H))+Math.imul(l,j)|0))<<13)|0;h=((o=Math.imul(l,H))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(d,j),n=(n=Math.imul(d,H))+Math.imul(p,j)|0,o=Math.imul(p,H);var bt=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(l,F)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,H))+Math.imul(g,j)|0,o=Math.imul(g,H),i=i+Math.imul(d,F)|0,n=(n=n+Math.imul(d,K)|0)+Math.imul(p,F)|0,o=o+Math.imul(p,K)|0;var gt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,H))+Math.imul(w,j)|0,o=Math.imul(w,H),i=i+Math.imul(b,F)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,K)|0,i=i+Math.imul(d,G)|0,n=(n=n+Math.imul(d,W)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,W)|0;var vt=(h+(i=i+Math.imul(c,Y)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,H))+Math.imul($,j)|0,o=Math.imul($,H),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,F)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,W)|0,i=i+Math.imul(d,Y)|0,n=(n=n+Math.imul(d,J)|0)+Math.imul(p,Y)|0,o=o+Math.imul(p,J)|0;var yt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,H))+Math.imul(A,j)|0,o=Math.imul(A,H),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,K)|0)+Math.imul($,F)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(d,Q)|0,n=(n=n+Math.imul(d,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,H))+Math.imul(T,j)|0,o=Math.imul(T,H),i=i+Math.imul(k,F)|0,n=(n=n+Math.imul(k,K)|0)+Math.imul(A,F)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul($,G)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,i=i+Math.imul(d,rt)|0,n=(n=n+Math.imul(d,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,j),n=(n=Math.imul(P,H))+Math.imul(I,j)|0,o=Math.imul(I,H),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(T,F)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul($,Y)|0,o=o+Math.imul($,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,it)|0,i=i+Math.imul(d,ot)|0,n=(n=n+Math.imul(d,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var St=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,H))+Math.imul(N,j)|0,o=Math.imul(N,H),i=i+Math.imul(P,F)|0,n=(n=n+Math.imul(P,K)|0)+Math.imul(I,F)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul($,Q)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,i=i+Math.imul(d,ut)|0,n=(n=n+Math.imul(d,ht)|0)+Math.imul(p,ut)|0,o=o+Math.imul(p,ht)|0;var $t=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,H))+Math.imul(D,j)|0,o=Math.imul(D,H),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,K)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,W)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(b,ut)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,i=i+Math.imul(d,ct)|0,n=(n=n+Math.imul(d,lt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,lt)|0;var Et=(h+(i=i+Math.imul(c,dt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(l,dt)|0))<<13)|0;h=((o=o+Math.imul(l,pt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,F),n=(n=Math.imul(U,K))+Math.imul(D,F)|0,o=Math.imul(D,K),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul($,ot)|0,o=o+Math.imul($,at)|0,i=i+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,lt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,lt)|0;var kt=(h+(i=i+Math.imul(d,dt)|0)|0)+((8191&(n=(n=n+Math.imul(d,pt)|0)+Math.imul(p,dt)|0))<<13)|0;h=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,W))+Math.imul(D,G)|0,o=Math.imul(D,W),i=i+Math.imul(O,Y)|0,n=(n=n+Math.imul(O,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(k,ot)|0,n=(n=n+Math.imul(k,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var At=(h+(i=i+Math.imul(b,dt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(g,dt)|0))<<13)|0;h=((o=o+Math.imul(g,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(U,Y),n=(n=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ht)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var Bt=(h+(i=i+Math.imul(y,dt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,dt)|0))<<13)|0;h=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(D,Q)|0,o=Math.imul(D,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,lt)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,lt)|0;var xt=(h+(i=i+Math.imul(S,dt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul($,dt)|0))<<13)|0;h=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(D,rt)|0,o=Math.imul(D,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0;var Tt=(h+(i=i+Math.imul(k,dt)|0)|0)+((8191&(n=(n=n+Math.imul(k,pt)|0)+Math.imul(A,dt)|0))<<13)|0;h=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,lt)|0;var Rt=(h+(i=i+Math.imul(x,dt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(T,dt)|0))<<13)|0;h=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,ut),n=(n=Math.imul(U,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,dt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(I,dt)|0))<<13)|0;h=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,ct),n=(n=Math.imul(U,lt))+Math.imul(D,ct)|0,o=Math.imul(D,lt);var It=(h+(i=i+Math.imul(O,dt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(N,dt)|0))<<13)|0;h=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Ct=(h+(i=Math.imul(U,dt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(D,dt)|0))<<13)|0;return h=((o=Math.imul(D,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=bt,u[2]=gt,u[3]=vt,u[4]=yt,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=$t,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Bt,u[13]=xt,u[14]=Tt,u[15]=Rt,u[16]=Pt,u[17]=It,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function _(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(l=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):_(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},d.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>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},n.prototype.isubn=function(t){if(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)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var _=0,d=1;0==(r.words[0]&d)&&_<26;++_,d<<=1);if(_>0)for(r.iushrn(_);_-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=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;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.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);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new w(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var p={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function y(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}m.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(b,m),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(p[t])return p[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new y}return p[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var _=c,d=0;0!==_.cmp(o);d++)_=_.redSqr();var p=this.pow(h,new n(1).iushln(l-d-1));f=f.redMul(p),h=p.redSqr(),c=c.redMul(h),l=d}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_553,this),_$bn_553=_$bn_553.exports;var __Buffer_556=_$safeBuffer_576.Buffer,_$withPublic_556=function(t,e){return __Buffer_556.from(t.toRed(_$bn_553.mont(e.modulus)).redPow(new _$bn_553(e.publicExponent)).fromRed().toArray())},__Buffer_555=_$safeBuffer_576.Buffer,_$publicEncrypt_555=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=_$parseAsn1_542(t);if(4===i)n=function(t,e){var r=t.modulus.byteLength(),i=e.length,n=_$browser_465("sha1").update(__Buffer_555.alloc(0)).digest(),o=n.length,a=2*o;if(i>r-a-2)throw new Error("message too long");var s=__Buffer_555.alloc(r-i-a-2),u=r-o-1,h=_$browser_558(o),f=_$xor_557(__Buffer_555.concat([n,s,__Buffer_555.alloc(1,1),e],u),_$mgf_552(h,u)),c=_$xor_557(h,_$mgf_552(f,o));return new _$bn_553(__Buffer_555.concat([__Buffer_555.alloc(1),c,f],r))}(o,e);else if(1===i)n=function(t,e,r){var i,n=e.length,o=t.modulus.byteLength();if(n>o-11)throw new Error("message too long");return i=r?__Buffer_555.alloc(o-n-3,255):function(t){for(var e,r=__Buffer_555.allocUnsafe(t),i=0,n=_$browser_558(2*t),o=0;i=0)throw new Error("data too long for modulus")}return r?_$browserifyRsa_436(n,o):_$withPublic_556(n,o)},__Buffer_554=_$safeBuffer_576.Buffer,_$privateDecrypt_554=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=_$parseAsn1_542(t),a=o.modulus.byteLength();if(e.length>a||new _$bn_553(e).cmp(o.modulus)>=0)throw new Error("decryption error");n=r?_$withPublic_556(new _$bn_553(e),o):_$browserifyRsa_436(e,o);var s=__Buffer_554.alloc(a-n.length);if(n=__Buffer_554.concat([s,n],a),4===i)return function(t,e){var r=t.modulus.byteLength(),i=_$browser_465("sha1").update(__Buffer_554.alloc(0)).digest(),n=i.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,n+1),a=e.slice(n+1),s=_$xor_557(o,_$mgf_552(a,n)),u=_$xor_557(a,_$mgf_552(s,r-n-1));if(function(t,e){t=__Buffer_554.from(t),e=__Buffer_554.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));for(var n=-1;++n=e.length){o++;break}var a=e.slice(2,n-1);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return e.slice(n)}(0,n,r);if(3===i)return n;throw new Error("unknown padding")},_$browser_551={};_$browser_551.publicEncrypt=_$publicEncrypt_555,_$browser_551.privateDecrypt=_$privateDecrypt_554,_$browser_551.privateEncrypt=function(t,e){return _$browser_551.publicEncrypt(t,e,!0)},_$browser_551.publicDecrypt=function(t,e){return _$browser_551.privateDecrypt(t,e,!0)};var _$browser_559={};(function(t,e){"use strict";function r(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var i=_$safeBuffer_576.Buffer,n=_$safeBuffer_576.kMaxLength,o=e.crypto||e.msCrypto,a=Math.pow(2,32)-1;function s(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>a||t<0)throw new TypeError("offset must be a uint32");if(t>n||t>e)throw new RangeError("offset out of range")}function u(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>a||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>n)throw new RangeError("buffer too small")}function h(e,r,i,n){if(t.browser){var a=e.buffer,s=new Uint8Array(a,r,i);return o.getRandomValues(s),n?void t.nextTick((function(){n(null,e)})):e}if(!n)return _$browser_558(i).copy(e,r),e;_$browser_558(i,(function(t,i){if(t)return n(t);i.copy(e,r),n(null,e)}))}o&&o.getRandomValues||!t.browser?(_$browser_559.randomFill=function(t,r,n,o){if(!(i.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)o=r,r=0,n=t.length;else if("function"==typeof n)o=n,n=t.length-r;else if("function"!=typeof o)throw new TypeError('"cb" argument must be a function');return s(r,t.length),u(n,r,t.length),h(t,r,n,o)},_$browser_559.randomFillSync=function(t,r,n){if(void 0===r&&(r=0),!(i.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return s(r,t.length),void 0===n&&(n=t.length-r),u(n,r,t.length),h(t,r,n)}):(_$browser_559.randomFill=r,_$browser_559.randomFillSync=r)}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$utils_350={};(function(t,e){const r=_$cryptoBrowserify_469({});function i(t,e,r,i,n,u,h){let f;for(s(t,e+64*(2*i-1),n,0,64),f=0;f<2*i;f++)a(t,64*f,n,0,64),o(n,u,h),s(n,0,t,r+64*f,64);for(f=0;f>>32-e}function o(t,e,r){let i;for(i=0;i<16;i++)e[i]=(255&t[4*i+0])<<0,e[i]|=(255&t[4*i+1])<<8,e[i]|=(255&t[4*i+2])<<16,e[i]|=(255&t[4*i+3])<<24;for(s(e,0,r,0,16),i=8;i>0;i-=2)r[4]^=n(r[0]+r[12],7),r[8]^=n(r[4]+r[0],9),r[12]^=n(r[8]+r[4],13),r[0]^=n(r[12]+r[8],18),r[9]^=n(r[5]+r[1],7),r[13]^=n(r[9]+r[5],9),r[1]^=n(r[13]+r[9],13),r[5]^=n(r[1]+r[13],18),r[14]^=n(r[10]+r[6],7),r[2]^=n(r[14]+r[10],9),r[6]^=n(r[2]+r[14],13),r[10]^=n(r[6]+r[2],18),r[3]^=n(r[15]+r[11],7),r[7]^=n(r[3]+r[15],9),r[11]^=n(r[7]+r[3],13),r[15]^=n(r[11]+r[7],18),r[1]^=n(r[0]+r[3],7),r[2]^=n(r[1]+r[0],9),r[3]^=n(r[2]+r[1],13),r[0]^=n(r[3]+r[2],18),r[6]^=n(r[5]+r[4],7),r[7]^=n(r[6]+r[5],9),r[4]^=n(r[7]+r[6],13),r[5]^=n(r[4]+r[7],18),r[11]^=n(r[10]+r[9],7),r[8]^=n(r[11]+r[10],9),r[9]^=n(r[8]+r[11],13),r[10]^=n(r[9]+r[8],18),r[12]^=n(r[15]+r[14],7),r[13]^=n(r[12]+r[15],9),r[14]^=n(r[13]+r[12],13),r[15]^=n(r[14]+r[13],18);for(i=0;i<16;++i)e[i]=r[i]+e[i];for(i=0;i<16;i++){let r=4*i;t[r+0]=e[i]>>0&255,t[r+1]=e[i]>>8&255,t[r+2]=e[i]>>16&255,t[r+3]=e[i]>>24&255}}function a(t,e,r,i,n){for(let o=0;o 0 and a power of 2");if(n>2147483647/128/o)throw Error("Parameter N is too large");if(o>2147483647/128/a)throw Error("Parameter r is too large");let h,f=t.alloc(256*o),c=t.alloc(128*o*n),l=new Int32Array(16),_=new Int32Array(16),d=t.alloc(64),p=r.pbkdf2Sync(e,i,1,128*a*o,"sha256");if(u){let t=a*n*2,e=0;h=function(){++e%1e3==0&&u({current:e,total:t,percent:e/t*100})}}return{XY:f,V:c,B32:l,x:_,_X:d,B:p,tickCallback:h}},smix:async function(t,r,n,o,s,u,h,f,c,l,_){_=_||5e3;let d,p=128*n;for(t.copy(u,0,r,r+p),d=0;de(t)),i(u,0,p,n,h,f,c),l&&l();for(d=0;de(t)),i(u,0,p,n,h,f,c),l&&l()}u.copy(t,r,0,0+p)},smixSync:function(t,e,r,n,o,s,u,h,f,c){let l,_=128*r;for(t.copy(s,0,e,e+_),l=0;l=0&&(i=!0)})),Object.keys(e).forEach((function(t){r+=o[t]*e[t]})),i&&(r+=2),r+=40,Math.ceil(r/4)}encryptBIP38(t,e){const r=_$wif_393.decode(t);return _$bip38_175.encrypt(r.privateKey,r.compressed,e)}decryptBIP38(t,e,r="mainnet"){const i=_$bip38_175.decrypt(t,e);let n;return n="testnet"===r?239:128,_$wif_393.encode(n,i.privateKey,i.compressed)}},_$crypto_10=class{static sha256(t){return _$src_48.crypto.sha256(t)}static ripemd160(t){return _$src_48.crypto.ripemd160(t)}static hash256(t){return _$src_48.crypto.hash256(t)}static hash160(t){return _$src_48.crypto.hash160(t)}static randomBytes(t=16){return _$browser_342(t)}},_$bind_146=function(t,e){return function(){for(var r=new Array(arguments.length),i=0;i=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},_$isURLSameOrigin_152=_$utils_156.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var i=t;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=_$utils_156.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},_$xhr_131=function(t){return new Promise((function(r,i){var n=t.data,o=t.headers;_$utils_156.isFormData(n)&&delete o["Content-Type"];var a=new XMLHttpRequest;if(t.auth){var s=t.auth.username||"",u=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(s+":"+u)}var h=_$buildFullPath_138(t.baseURL,t.url);if(a.open(t.method.toUpperCase(),_$buildURL_147(h,t.params,t.paramsSerializer),!0),a.timeout=t.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var e="getAllResponseHeaders"in a?_$parseHeaders_154(a.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:e,config:t,request:a};_$settle_143(r,i,n),a=null}},a.onabort=function(){a&&(i(_$createError_139("Request aborted",t,"ECONNABORTED",a)),a=null)},a.onerror=function(){i(_$createError_139("Network Error",t,null,a)),a=null},a.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),i(_$createError_139(e,t,"ECONNABORTED",a)),a=null},_$utils_156.isStandardBrowserEnv()){var f=(t.withCredentials||_$isURLSameOrigin_152(h))&&t.xsrfCookieName?_$cookies_149.read(t.xsrfCookieName):void 0;f&&(o[t.xsrfHeaderName]=f)}if("setRequestHeader"in a&&_$utils_156.forEach(o,(function(t,e){void 0===n&&"content-type"===e.toLowerCase()?delete o[e]:a.setRequestHeader(e,t)})),_$utils_156.isUndefined(t.withCredentials)||(a.withCredentials=!!t.withCredentials),t.responseType)try{a.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&a.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){a&&(a.abort(),i(t),a=null)})),n||(n=null),a.send(n)}))},_$defaults_145={};function throwIfCancellationRequested(t){t.cancelToken&&t.cancelToken.throwIfRequested()}(function(t){"use strict";var r={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!_$utils_156.isUndefined(t)&&_$utils_156.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var n,o={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(n=_$xhr_131),n),transformRequest:[function(t,e){return _$normalizeHeaderName_153(e,"Accept"),_$normalizeHeaderName_153(e,"Content-Type"),_$utils_156.isFormData(t)||_$utils_156.isArrayBuffer(t)||_$utils_156.isBuffer(t)||_$utils_156.isStream(t)||_$utils_156.isFile(t)||_$utils_156.isBlob(t)?t:_$utils_156.isArrayBufferView(t)?t.buffer:_$utils_156.isURLSearchParams(t)?(i(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_$utils_156.isObject(t)?(i(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_$utils_156.forEach(["delete","get","head"],(function(t){o.headers[t]={}})),_$utils_156.forEach(["post","put","patch"],(function(t){o.headers[t]=_$utils_156.merge(r)})),_$defaults_145=o}).call(this,_$browser_550);var _$dispatchRequest_140=function(t){return throwIfCancellationRequested(t),t.headers=t.headers||{},t.data=_$transformData_144(t.data,t.headers,t.transformRequest),t.headers=_$utils_156.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),_$utils_156.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||_$defaults_145.adapter)(t).then((function(e){return throwIfCancellationRequested(t),e.data=_$transformData_144(e.data,e.headers,t.transformResponse),e}),(function(e){return _$isCancel_135(e)||(throwIfCancellationRequested(t),e&&e.response&&(e.response.data=_$transformData_144(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},_$mergeConfig_142=function(t,e){e=e||{};var r={},i=["url","method","data"],n=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(t,e){return _$utils_156.isPlainObject(t)&&_$utils_156.isPlainObject(e)?_$utils_156.merge(t,e):_$utils_156.isPlainObject(e)?_$utils_156.merge({},e):_$utils_156.isArray(e)?e.slice():e}function u(i){_$utils_156.isUndefined(e[i])?_$utils_156.isUndefined(t[i])||(r[i]=s(void 0,t[i])):r[i]=s(t[i],e[i])}_$utils_156.forEach(i,(function(t){_$utils_156.isUndefined(e[t])||(r[t]=s(void 0,e[t]))})),_$utils_156.forEach(n,u),_$utils_156.forEach(o,(function(i){_$utils_156.isUndefined(e[i])?_$utils_156.isUndefined(t[i])||(r[i]=s(void 0,t[i])):r[i]=s(void 0,e[i])})),_$utils_156.forEach(a,(function(i){i in e?r[i]=s(t[i],e[i]):i in t&&(r[i]=s(void 0,t[i]))}));var h=i.concat(n).concat(o).concat(a),f=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===h.indexOf(t)}));return _$utils_156.forEach(f,u),r},_$Axios_136={};function Axios(t){this.defaults=t,this.interceptors={request:new _$InterceptorManager_137,response:new _$InterceptorManager_137}}Axios.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=_$mergeConfig_142(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[_$dispatchRequest_140,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)r=r.then(e.shift(),e.shift());return r},Axios.prototype.getUri=function(t){return t=_$mergeConfig_142(this.defaults,t),_$buildURL_147(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},_$utils_156.forEach(["delete","get","head","options"],(function(t){Axios.prototype[t]=function(e,r){return this.request(_$mergeConfig_142(r||{},{method:t,url:e,data:(r||{}).data}))}})),_$utils_156.forEach(["post","put","patch"],(function(t){Axios.prototype[t]=function(e,r,i){return this.request(_$mergeConfig_142(i||{},{method:t,url:e,data:r}))}})),_$Axios_136=Axios;var _$Cancel_133={};function Cancel(t){this.message=t}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,_$Cancel_133=Cancel;var _$CancelToken_134={};function CancelToken(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;t((function(t){r.reason||(r.reason=new _$Cancel_133(t),e(r.reason))}))}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},CancelToken.source=function(){var t;return{token:new CancelToken((function(e){t=e})),cancel:t}},_$CancelToken_134=CancelToken;var _$spread_155=function(t){return function(e){return t.apply(null,e)}},_$isAxiosError_151=function(t){return"object"==typeof t&&!0===t.isAxiosError},_$axios_132={};function createInstance(t){var e=new _$Axios_136(t),r=_$bind_146(_$Axios_136.prototype.request,e);return _$utils_156.extend(r,_$Axios_136.prototype,e),_$utils_156.extend(r,e),r}var axios=createInstance(_$defaults_145);axios.Axios=_$Axios_136,axios.create=function(t){return createInstance(_$mergeConfig_142(axios.defaults,t))},axios.Cancel=_$Cancel_133,axios.CancelToken=_$CancelToken_134,axios.isCancel=_$isCancel_135,axios.all=function(t){return Promise.all(t)},axios.spread=_$spread_155,axios.isAxiosError=_$isAxiosError_151,_$axios_132=axios,_$axios_132.default=axios;var _$axios_130=_$axios_132;let _this;var _$util_31=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},_this=this}floor8(t){const e=Number(t);if(isNaN(e))throw new Error("input must be a number");let r=1e8*e;return r=Math.floor(r),r/1e8}floor2(t){const e=Number(t);if(isNaN(e))throw new Error("input must be a number");let r=100*e;return r=Math.floor(r),r/100}chunk20(t){try{if(!Array.isArray(t))throw new Error("input must be an array");let e=0;const r=[];for(;esetTimeout(e,t))}async validateAddress(t){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}util/validateAddress/${t}`,_this.axiosOptions)).data;if(Array.isArray(t)){const e={method:"POST",url:this.restURL+"util/validateAddress",data:{addresses:t},headers:{authorization:"Token "+this.apiToken}};return(await _$axios_130(e)).data}throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}};let ___this_8;var _$blockchain_8=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_8=this}async getBestBlockHash(){try{return(await _$axios_130.get(this.restURL+"blockchain/getBestBlockHash",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlock(t,e=!0){try{return(await _$axios_130.get(`${this.restURL}blockchain/getBlock/${t}?verbose=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getBlockchainInfo(){try{return(await _$axios_130.get(this.restURL+"blockchain/getBlockchainInfo",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlockCount(){try{return(await _$axios_130.get(this.restURL+"blockchain/getBlockCount",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlockHash(t=1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_130.get(`${this.restURL}blockchain/getBlockHash/${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getBlockHeader(t,e=!0){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}blockchain/getBlockHeader/${t}?verbose=${e}`,___this_8.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/getBlockHeader",{hashes:t,verbose:e},___this_8.axiosOptions)).data;throw new Error("Input hash must be a string or array of strings.")}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getChainTips(){try{return(await _$axios_130.get(this.restURL+"blockchain/getChainTips",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getDifficulty(){try{return(await _$axios_130.get(this.restURL+"blockchain/getDifficulty",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getMempoolAncestors(t,e=!1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_130.get(`${this.restURL}blockchain/getMempoolAncestors/${t}?verbose=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getMempoolDescendants(t,e=!1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_130.get(`${this.restURL}blockchain/getMempoolDescendants/${t}?verbose=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getMempoolEntry(t){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}blockchain/getMempoolEntry/${t}`,___this_8.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/getMempoolEntry",{txids:t},___this_8.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getMempoolInfo(){try{return(await _$axios_130.get(this.restURL+"blockchain/getMempoolInfo",___this_8.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getRawMempool(t=!1){try{return(await _$axios_130.get(`${this.restURL}blockchain/getRawMempool?vebose=${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getTxOut(t,e,r=!0){try{if("string"!=typeof t||64!==t.length)throw new Error("txid needs to be a proper transaction ID");if(isNaN(e))throw new Error("n must be an integer");if("boolean"!=typeof r)throw new Error("includeMempool input must be of type boolean");return(await _$axios_130.post(this.restURL+"blockchain/getTxOut",{txid:t,vout:e,mempool:r},___this_8.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}async getTxOutProof(t){try{if("string"==typeof t){const e=`${this.restURL}blockchain/getTxOutProof/${t}`;return(await _$axios_130.get(e,___this_8.axiosOptions)).data}if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/getTxOutProof",{txids:t},___this_8.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async preciousBlock(t){try{return(await _$axios_130.get(`${this.restURL}blockchain/preciousBlock/${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async pruneBlockchain(t){try{return(await _$axios_130.post(`${this.restURL}blockchain/pruneBlockchain/${t}`,___this_8.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async verifyChain(t=3,e=6){try{return(await _$axios_130.get(`${this.restURL}blockchain/verifyChain?checklevel=${t}&nblocks=${e}`,___this_8.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async verifyTxOutProof(t){try{if("string"==typeof t)return(await _$axios_130.get(`${this.restURL}blockchain/verifyTxOutProof/${t}`,___this_8.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.restURL+"blockchain/verifyTxOutProof",{proofs:t},___this_8.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}};let ___this_9;var _$control_9=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_9=this}async getNetworkInfo(){try{return(await _$axios_130.get(this.restURL+"control/getNetworkInfo",___this_9.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getMemoryInfo(){try{return(await _$axios_130.get(this.restURL+"control/getMemoryInfo",___this_9.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}};let ___this_14;var _$generating_14=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_14=this}async generateToAddress(t,e,r=1e6){try{return(await _$axios_130.post(`${this.restURL}generating/generateToAddress/${t}/${e}?maxtries=${r}`,___this_14.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}};let ___this_17;var _$mining_17=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_17=this}async getBlockTemplate(t){try{return(await _$axios_130.get(`${this.restURL}mining/getBlockTemplate/${t}`,___this_17.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getMiningInfo(){try{return(await _$axios_130.get(this.restURL+"mining/getMiningInfo",___this_17.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getNetworkHashps(t=120,e=1){try{return(await _$axios_130.get(`${this.restURL}mining/getNetworkHashps?nblocks=${t}&height=${e}`,___this_17.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async submitBlock(t,e){let r=`${this.restURL}mining/submitBlock/${t}`;e&&(r=`${r}?parameters=${e}`);try{return(await _$axios_130.post(r,___this_17.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}},_$bignumber_168={exports:{}};!function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",s=1e14,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e9;function f(t){var e=0|t;return t>0||t===e?e:e-1}function c(t){for(var e,r,i=1,n=t.length,o=t[0]+"";ih^r?1:-1;for(s=(u=n.length)<(h=o.length)?u:h,a=0;ao[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function _(t,e,r,i){if(tr||t!==n(t))throw Error(o+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function d(t){var e=t.c.length-1;return f(t.e/14)==e&&t.c[e]%2!=0}function p(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function m(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eI?d.c=d.e=null:t.e=10;h/=10,u++);return void(u>I?d.c=d.e=null:(d.e=u,d.c=[t]))}l=String(t)}else{if(!r.test(l=String(t)))return v(d,l,f);d.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(u=l.indexOf("."))>-1&&(l=l.replace(".","")),(h=l.search(/e/i))>0?(u<0&&(u=h),u+=+l.slice(h+1),l=l.substring(0,h)):u<0&&(u=l.length)}else{if(_(e,2,U.length,"Base"),10==e)return q(d=new D(t),B+d.e+1,x);if(l=String(t),f="number"==typeof t){if(0*t!=0)return v(d,l,f,e);if(d.s=1/t<0?(l=l.slice(1),-1):1,D.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error(a+t)}else d.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(i=U.slice(0,e),u=h=0,c=l.length;hu){u=c;continue}}else if(!s&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){s=!0,h=-1,u=0;continue}return v(d,String(t),f,e)}f=!1,(u=(l=g(l,e,10,d.s)).indexOf("."))>-1?l=l.replace(".",""):u=l.length}for(h=0;48===l.charCodeAt(h);h++);for(c=l.length;48===l.charCodeAt(--c););if(l=l.slice(h,++c)){if(c-=h,f&&D.DEBUG&&c>15&&(t>9007199254740991||t!==n(t)))throw Error(a+d.s*t);if((u=u-h-1)>I)d.c=d.e=null;else if(u=R)?p(u,a):m(u,a,"0");else if(o=(t=q(new D(t),e,r)).e,s=(u=c(t.c)).length,1==i||2==i&&(e<=o||o<=T)){for(;ss){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-s)>0)for(o+1==s&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function j(t,e){for(var r,i=1,n=new D(t[0]);i=10;n/=10,i++);return(r=i+14*r-1)>I?t.c=t.e=null:r=10;c/=10,a++);if((h=e-a)<0)h+=14,f=e,d=(l=p[_=0])/m[a-f-1]%10|0;else if((_=i((h+1)/14))>=p.length){if(!o)break t;for(;p.length<=_;p.push(0));l=d=0,a=1,f=(h%=14)-14+1}else{for(l=c=p[_],a=1;c>=10;c/=10,a++);d=(f=(h%=14)-14+a)<0?0:l/m[a-f-1]%10|0}if(o=o||e<0||null!=p[_+1]||(f<0?l:l%m[a-f-1]),o=r<4?(d||o)&&(0==r||r==(t.s<0?3:2)):d>5||5==d&&(4==r||o||6==r&&(h>0?f>0?l/m[a-f]:0:p[_-1])%10&1||r==(t.s<0?8:7)),e<1||!p[0])return p.length=0,o?(e-=t.e+1,p[0]=m[(14-e%14)%14],t.e=-e||0):p[0]=t.e=0,t;if(0==h?(p.length=_,c=1,_--):(p.length=_+1,c=m[14-h],p[_]=f>0?n(l/m[a-f]%m[f])*c:0),o)for(;;){if(0==_){for(h=1,f=p[0];f>=10;f/=10,h++);for(f=p[0]+=c,c=1;f>=10;f/=10,c++);h!=c&&(t.e++,p[0]==s&&(p[0]=1));break}if(p[_]+=c,p[_]!=s)break;p[_--]=0,c=1}for(h=p.length;0===p[--h];p.pop());}t.e>I?t.c=t.e=null:t.e=R?p(e,r):m(e,r,"0"),t.s<0?"-"+e:e)}return D.clone=t,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(o+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(_(r=t[e],0,h,e),B=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(_(r=t[e],0,8,e),x=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(_(r[0],-h,0,e),_(r[1],0,h,e),T=r[0],R=r[1]):(_(r,-h,h,e),T=-(R=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)_(r[0],-h,-1,e),_(r[1],1,h,e),P=r[0],I=r[1];else{if(_(r,-h,h,e),!r)throw Error(o+e+" cannot be zero: "+r);P=-(I=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(o+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!r,Error(o+"crypto unavailable");C=r}else C=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(_(r=t[e],0,9,e),O=r),t.hasOwnProperty(e="POW_PRECISION")&&(_(r=t[e],0,h,e),N=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(o+e+" not an object: "+r);L=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(o+e+" invalid: "+r);U=r}}return{DECIMAL_PLACES:B,ROUNDING_MODE:x,EXPONENTIAL_AT:[T,R],RANGE:[P,I],CRYPTO:C,MODULO_MODE:O,POW_PRECISION:N,FORMAT:L,ALPHABET:U}},D.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!D.DEBUG)return!0;var e,r,i=t.c,a=t.e,u=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===u||-1===u)&&a>=-h&&a<=h&&a===n(a)){if(0===i[0]){if(0===a&&1===i.length)return!0;break t}if((e=(a+1)%14)<1&&(e+=14),String(i[0]).length==e){for(e=0;e=s||r!==n(r))break t;if(0!==r)return!0}}}else if(null===i&&null===a&&(null===u||1===u||-1===u))return!0;throw Error(o+"Invalid BigNumber: "+t)},D.maximum=D.max=function(){return j(arguments,k.lt)},D.minimum=D.min=function(){return j(arguments,k.gt)},D.random=(y=9007199254740992*Math.random()&2097151?function(){return n(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,a,s,f,c=0,l=[],d=new D(A);if(null==t?t=B:_(t,0,h),s=i(t/14),C)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(s*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(f%1e14),c+=2);c=s/2}else{if(!crypto.randomBytes)throw C=!1,Error(o+"crypto unavailable");for(e=crypto.randomBytes(s*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(f%1e14),c+=7);c=s/7}if(!C)for(;c=10;f/=10,c++);c<14&&(a-=14-c)}return d.e=a,d.c=l,d}),D.sum=function(){for(var t=1,e=arguments,r=new D(e[0]);tr-1&&(null==a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}return function(e,r,i,n,o){var a,s,u,h,f,l,_,d,p=e.indexOf("."),g=B,v=x;for(p>=0&&(h=N,N=0,e=e.replace(".",""),l=(d=new D(r)).pow(e.length-p),N=h,d.c=t(m(c(l.c),l.e,"0"),10,i,"0123456789"),d.e=d.c.length),u=h=(_=t(e,r,i,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==_[--h];_.pop());if(!_[0])return a.charAt(0);if(p<0?--u:(l.c=_,l.e=u,l.s=n,_=(l=b(l,d,g,v,i)).c,f=l.r,u=l.e),p=_[s=u+g+1],h=i/2,f=f||s<0||null!=_[s+1],f=v<4?(null!=p||f)&&(0==v||v==(l.s<0?3:2)):p>h||p==h&&(4==v||f||6==v&&1&_[s-1]||v==(l.s<0?8:7)),s<1||!_[0])e=f?m(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(_.length=s,f)for(--i;++_[--s]>i;)_[s]=0,s||(++u,_=[1].concat(_));for(h=_.length;!_[--h];);for(p=0,e="";p<=h;e+=a.charAt(_[p++]));e=m(e,u,a.charAt(0))}return e}}(),b=function(){function t(t,e,r){var i,n,o,a,s=0,u=t.length,h=e%1e7,f=e/1e7|0;for(t=t.slice();u--;)s=((n=h*(o=t[u]%1e7)+(i=f*o+(a=t[u]/1e7|0)*h)%1e7*1e7+s)/r|0)+(i/1e7|0)+f*a,t[u]=n%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,i){var n,o;if(r!=i)o=r>i?1:-1;else for(n=o=0;ne[n]?1:-1;break}return o}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,o,a,u,h){var c,l,_,d,p,m,b,g,v,y,w,M,S,$,E,k,A,B=i.s==o.s?1:-1,x=i.c,T=o.c;if(!(x&&x[0]&&T&&T[0]))return new D(i.s&&o.s&&(x?!T||x[0]!=T[0]:T)?x&&0==x[0]||!T?0*B:B/0:NaN);for(v=(g=new D(B)).c=[],B=a+(l=i.e-o.e)+1,h||(h=s,l=f(i.e/14)-f(o.e/14),B=B/14|0),_=0;T[_]==(x[_]||0);_++);if(T[_]>(x[_]||0)&&l--,B<0)v.push(1),d=!0;else{for($=x.length,k=T.length,_=0,B+=2,(p=n(h/(T[0]+1)))>1&&(T=t(T,p,h),x=t(x,p,h),k=T.length,$=x.length),S=k,w=(y=x.slice(0,k)).length;w=h/2&&E++;do{if(p=0,(c=e(T,y,k,w))<0){if(M=y[0],k!=w&&(M=M*h+(y[1]||0)),(p=n(M/E))>1)for(p>=h&&(p=h-1),b=(m=t(T,p,h)).length,w=y.length;1==e(m,y,b,w);)p--,r(m,k=10;B/=10,_++);q(g,a+(g.e=_+14*l-1)+1,u,d)}else g.e=l,g.r=+d;return g}}(),w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,S=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g,v=function(t,e,r,i){var n,a=r?e:e.replace(E,"");if($.test(a))t.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(w,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,a=a.replace(M,"$1").replace(S,"0.$1")),e!=a))return new D(a,n);if(D.DEBUG)throw Error(o+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},k.absoluteValue=k.abs=function(){var t=new D(this);return t.s<0&&(t.s=1),t},k.comparedTo=function(t,e){return l(this,new D(t,e))},k.decimalPlaces=k.dp=function(t,e){var r,i,n,o=this;if(null!=t)return _(t,0,h),null==e?e=x:_(e,0,8),q(new D(o),t+o.e+1,e);if(!(r=o.c))return null;if(i=14*((n=r.length-1)-f(this.e/14)),n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},k.dividedBy=k.div=function(t,e){return b(this,new D(t,e),B,x)},k.dividedToIntegerBy=k.idiv=function(t,e){return b(this,new D(t,e),0,1)},k.exponentiatedBy=k.pow=function(t,e){var r,a,s,u,h,f,c,l,_=this;if((t=new D(t)).c&&!t.isInteger())throw Error(o+"Exponent not an integer: "+F(t));if(null!=e&&(e=new D(e)),h=t.e>14,!_.c||!_.c[0]||1==_.c[0]&&!_.e&&1==_.c.length||!t.c||!t.c[0])return l=new D(Math.pow(+F(_),h?2-d(t):+F(t))),e?l.mod(e):l;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new D(NaN);(a=!f&&_.isInteger()&&e.isInteger())&&(_=_.mod(e))}else{if(t.e>9&&(_.e>0||_.e<-1||(0==_.e?_.c[0]>1||h&&_.c[1]>=24e7:_.c[0]<8e13||h&&_.c[0]<=9999975e7)))return u=_.s<0&&d(t)?-0:0,_.e>-1&&(u=1/u),new D(f?1/u:u);N&&(u=i(N/14+2))}for(h?(r=new D(.5),f&&(t.s=1),c=d(t)):c=(s=Math.abs(+F(t)))%2,l=new D(A);;){if(c){if(!(l=l.times(_)).c)break;u?l.c.length>u&&(l.c.length=u):a&&(l=l.mod(e))}if(s){if(0===(s=n(s/2)))break;c=s%2}else if(q(t=t.times(r),t.e+1,1),t.e>14)c=d(t);else{if(0==(s=+F(t)))break;c=s%2}_=_.times(_),u?_.c&&_.c.length>u&&(_.c.length=u):a&&(_=_.mod(e))}return a?l:(f&&(l=A.div(l)),e?l.mod(e):u?q(l,N,x,void 0):l)},k.integerValue=function(t){var e=new D(this);return null==t?t=x:_(t,0,8),q(e,e.e+1,t)},k.isEqualTo=k.eq=function(t,e){return 0===l(this,new D(t,e))},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(t,e){return l(this,new D(t,e))>0},k.isGreaterThanOrEqualTo=k.gte=function(t,e){return 1===(e=l(this,new D(t,e)))||0===e},k.isInteger=function(){return!!this.c&&f(this.e/14)>this.c.length-2},k.isLessThan=k.lt=function(t,e){return l(this,new D(t,e))<0},k.isLessThanOrEqualTo=k.lte=function(t,e){return-1===(e=l(this,new D(t,e)))||0===e},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&0==this.c[0]},k.minus=function(t,e){var r,i,n,o,a=this,u=a.s;if(e=(t=new D(t,e)).s,!u||!e)return new D(NaN);if(u!=e)return t.s=-e,a.plus(t);var h=a.e/14,c=t.e/14,l=a.c,_=t.c;if(!h||!c){if(!l||!_)return l?(t.s=-e,t):new D(_?a:NaN);if(!l[0]||!_[0])return _[0]?(t.s=-e,t):new D(l[0]?a:3==x?-0:0)}if(h=f(h),c=f(c),l=l.slice(),u=h-c){for((o=u<0)?(u=-u,n=l):(c=h,n=_),n.reverse(),e=u;e--;n.push(0));n.reverse()}else for(i=(o=(u=l.length)<(e=_.length))?u:e,u=e=0;e0)for(;e--;l[r++]=0);for(e=s-1;i>u;){if(l[--i]<_[i]){for(r=i;r&&!l[--r];l[r]=e);--l[r],l[i]+=s}l[i]-=_[i]}for(;0==l[0];l.splice(0,1),--c);return l[0]?H(t,l,c):(t.s=3==x?-1:1,t.c=[t.e=0],t)},k.modulo=k.mod=function(t,e){var r,i,n=this;return t=new D(t,e),!n.c||!t.s||t.c&&!t.c[0]?new D(NaN):!t.c||n.c&&!n.c[0]?new D(n):(9==O?(i=t.s,t.s=1,r=b(n,t,0,3),t.s=i,r.s*=i):r=b(n,t,0,O),(t=n.minus(r.times(t))).c[0]||1!=O||(t.s=n.s),t)},k.multipliedBy=k.times=function(t,e){var r,i,n,o,a,u,h,c,l,_,d,p,m,b,g=this,v=g.c,y=(t=new D(t,e)).c;if(!(v&&y&&v[0]&&y[0]))return!g.s||!t.s||v&&!v[0]&&!y||y&&!y[0]&&!v?t.c=t.e=t.s=null:(t.s*=g.s,v&&y?(t.c=[0],t.e=0):t.c=t.e=null),t;for(i=f(g.e/14)+f(t.e/14),t.s*=g.s,(h=v.length)<(_=y.length)&&(m=v,v=y,y=m,n=h,h=_,_=n),n=h+_,m=[];n--;m.push(0));for(b=s,1e7,n=_;--n>=0;){for(r=0,d=y[n]%1e7,p=y[n]/1e7|0,o=n+(a=h);o>n;)r=((c=d*(c=v[--a]%1e7)+(u=p*c+(l=v[a]/1e7|0)*d)%1e7*1e7+m[o]+r)/b|0)+(u/1e7|0)+p*l,m[o--]=c%b;m[o]=r}return r?++i:m.splice(0,1),H(t,m,i)},k.negated=function(){var t=new D(this);return t.s=-t.s||null,t},k.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new D(t,e)).s,!n||!e)return new D(NaN);if(n!=e)return t.s=-e,i.minus(t);var o=i.e/14,a=t.e/14,u=i.c,h=t.c;if(!o||!a){if(!u||!h)return new D(n/0);if(!u[0]||!h[0])return h[0]?t:new D(u[0]?i:0*n)}if(o=f(o),a=f(a),u=u.slice(),n=o-a){for(n>0?(a=o,r=h):(n=-n,r=u),r.reverse();n--;r.push(0));r.reverse()}for((n=u.length)-(e=h.length)<0&&(r=h,h=u,u=r,e=n),n=0;e;)n=(u[--e]=u[e]+h[e]+n)/s|0,u[e]=s===u[e]?0:u[e]%s;return n&&(u=[n].concat(u),++a),H(t,u,a)},k.precision=k.sd=function(t,e){var r,i,n,o=this;if(null!=t&&t!==!!t)return _(t,1,h),null==e?e=x:_(e,0,8),q(new D(o),t,e);if(!(r=o.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&o.e+1>i&&(i=o.e+1),i},k.shiftedBy=function(t){return _(t,-9007199254740991,9007199254740991),this.times("1e"+t)},k.squareRoot=k.sqrt=function(){var t,e,r,i,n,o=this,a=o.c,s=o.s,u=o.e,h=B+4,l=new D("0.5");if(1!==s||!a||!a[0])return new D(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(s=Math.sqrt(+F(o)))||s==1/0?(((e=c(a)).length+u)%2==0&&(e+="0"),s=Math.sqrt(+e),u=f((u+1)/2)-(u<0||u%2),r=new D(e=s==1/0?"5e"+u:(e=s.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new D(s+""),r.c[0])for((s=(u=r.e)+h)<3&&(s=0);;)if(n=r,r=l.times(n.plus(b(o,n,h,1))),c(n.c).slice(0,s)===(e=c(r.c)).slice(0,s)){if(r.e0&&p>0){for(a=p%u||u,c=d.substr(0,a);a0&&(c+=f+d.slice(a)),_&&(c="-"+c)}i=l?c+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):c}return(r.prefix||"")+i+(r.suffix||"")},k.toFraction=function(t){var e,r,i,n,a,s,h,f,l,_,d,p,m=this,g=m.c;if(null!=t&&(!(h=new D(t)).isInteger()&&(h.c||1!==h.s)||h.lt(A)))throw Error(o+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+F(h));if(!g)return new D(m);for(e=new D(A),l=r=new D(A),i=f=new D(A),p=c(g),a=e.e=p.length-m.e-1,e.c[0]=u[(s=a%14)<0?14+s:s],t=!t||h.comparedTo(e)>0?a>0?e:l:h,s=I,I=1/0,h=new D(p),f.c[0]=0;_=b(h,e,0,1),1!=(n=r.plus(_.times(i))).comparedTo(t);)r=i,i=n,l=f.plus(_.times(n=l)),f=n,e=h.minus(_.times(n=e)),h=n;return n=b(t.minus(r),i,0,1),f=f.plus(n.times(l)),r=r.plus(n.times(i)),f.s=l.s=m.s,d=b(l,i,a*=2,x).minus(m).abs().comparedTo(b(f,r,a,x).minus(m).abs())<1?[l,i]:[f,r],I=s,d},k.toNumber=function(){return+F(this)},k.toPrecision=function(t,e){return null!=t&&_(t,1,h),z(this,t,e,2)},k.toString=function(t){var e,r=this,i=r.s,n=r.e;return null===n?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=n<=T||n>=R?p(c(r.c),n):m(c(r.c),n,"0"):10===t?e=m(c((r=q(new D(r),B+n+1,x)).c),r.e,"0"):(_(t,2,U.length,"Base"),e=g(m(c(r.c),n,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},k.valueOf=k.toJSON=function(){return F(this)},k._isBigNumber=!0,null!=e&&D.set(e),D}()).default=e.BigNumber=e,"function"==typeof define&&define.amd?define((function(){return e})):_$bignumber_168.exports?_$bignumber_168.exports=e:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=e)}(this),_$bignumber_168=_$bignumber_168.exports;var _$dist_369={};(function(t){"use strict";var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$dist_369,"__esModule",{value:!0});const r=e(_$bignumber_168);_$dist_369.BN=r.default,_$dist_369.parseSLP=e=>{"string"==typeof e&&(e=t.from(e,"hex"));let i=0,n=e;const o=(t,e)=>{if(t)throw Error(e)},a=()=>{const t=n.readUInt8(i);return i+=1,new r.default(t)},s=()=>{const t=n.readUInt16LE(i);return i+=2,new r.default(t)},u=()=>{const t=n.readUInt32LE(i);return i+=4,new r.default(t)};o(0===n.length,"scriptpubkey cannot be empty"),o(106!==n[i],"scriptpubkey not op_return"),o(n.length<10,"scriptpubkey too small"),++i;const h=()=>{if(i===n.length)return-1;const t=a().toNumber();return t>0&&t<76?i+t>n.length?(--i,-1):t:76===t?i+1>=n.length?(--i,-1):a().toNumber():77===t?i+2>=n.length?(--i,-1):s().toNumber():78===t?i+4>=n.length?(--i,-1):u().toNumber():(--i,-1)},f=()=>{if(1===n.length)return a();if(2===n.length)return s();if(4===n.length)return u();if(8===n.length)return(()=>{const t=n.readUInt32LE(i);i+=4;const e=n.readUInt32LE(i);return i+=4,new r.default(e).multipliedBy(Math.pow(2,32)).plus(t)})();throw new Error("extraction of number from buffer failed")},c=t=>32===t.length,l=[];for(let t=h();t>=0;t=h()){const e=n.slice(i,i+t);if(o(i+t>n.length,"pushdata data extraction failed"),i+=t,l.push(e),1===l.length){const t=l[0];o(4!==t.length,"lokad id wrong size"),o(t[0]!=="S".charCodeAt(0)||t[1]!=="L".charCodeAt(0)||t[2]!=="P".charCodeAt(0)||0!==t[3],"SLP not in first chunk")}}o(i!==n.length,"trailing data"),o(0===l.length,"chunks empty");let _=0;const d=()=>{o(++_===l.length,"parsing ended early"),i=0,n=l[_]};d();const p=n.reverse();o(1!==p.length&&2!==p.length,"token_type string length must be 1 or 2");const m=f().toNumber();o(![1,65,129].includes(m),"token_type not token-type1, nft1-group, or nft1-child"),d();const b=n.toString();if("GENESIS"===b){o(10!==l.length,"wrong number of chunks"),d();const t=n;d();const e=n;d();const r=n;d();const i=n;o(!(0===i.length||32===i.length),"document_hash must be size 0 or 32"),d(),o(1!==n.length,"decimals string length must be 1");const a=f().toNumber();o(a>9,"decimals bigger than 9"),d();const s=n;let u=0;o(s.length>=2,"mint_baton_vout string length must be 0 or 1"),s.length>0&&(u=f().toNumber(),o(u<2,"mint_baton_vout must be at least 2")),d();const h=n.reverse();o(8!==h.length,"initial_qty must be provided as an 8-byte buffer");const c=f();return 65===m&&(o(0!==a,"NFT1 child token must have divisibility set to 0 decimal places"),o(0!==u,"NFT1 child token must not have a minting baton"),o(!c.isEqualTo(1),"NFT1 child token must have quantity of 1")),{tokenType:m,transactionType:b,data:{ticker:t,name:e,documentUri:r,documentHash:i,decimals:a,mintBatonVout:u,qty:c}}}if("MINT"===b){o(65===m,"NFT1 Child cannot have MINT transaction type."),o(6!==l.length,"wrong number of chunks"),d();const t=n;o(!c(t),"tokenId invalid size"),d();const e=n;let r=0;o(e.length>=2,"mint_baton_vout string length must be 0 or 1"),e.length>0&&(r=f().toNumber(),o(r<2,"mint_baton_vout must be at least 2")),d();const i=n.reverse();return o(8!==i.length,"additional_qty must be provided as an 8-byte buffer"),{tokenType:m,transactionType:b,data:{tokenId:t,mintBatonVout:r,qty:f()}}}if("SEND"===b){o(l.length<4,"wrong number of chunks"),d();const t=n;o(!c(t),"tokenId invalid size"),d();const e=[];for(;_!==l.length;){const t=n.reverse();o(8!==t.length,"amount string size not 8 bytes");const r=f();e.push(r),n=l[++_],i=0}return o(0===e.length,"token_amounts size is 0"),o(e.length>19,"token_amounts size is greater than 19"),{tokenType:m,transactionType:b,data:{tokenId:t,amounts:e}}}return o(!0,"unknown action type"),{tokenType:m,transactionType:b,data:{}}}}).call(this,_$buffer_460({}).Buffer);var _$utils_29={};let ___this_21;(function(t){let e;_$utils_29=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.slpParser=_$dist_369,this.authToken=t.authToken,this.axios=_$axios_130,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},e=this,this.whitelist=[],this.util=new _$util_31(t)}async list(t){let r,i;t?"string"==typeof t?(i="get",r=`${this.restURL}slp/list/${t}`):"object"==typeof t&&(i="post",r=this.restURL+"slp/list"):(i="get",r=this.restURL+"slp/list");try{let n;return(n="get"===i?await e.axios.get(r,e.axiosOptions):await e.axios.post(r,{tokenIds:t},e.axiosOptions)).data}catch(n){if(n.response&&n.response.data)throw n.response.data;throw n}}async balancesForAddress(t){try{if("string"==typeof t){const r=`${this.restURL}slp/balancesForAddress/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}if(Array.isArray(t)){const r=this.restURL+"slp/balancesForAddress";return(await e.axios.post(r,{addresses:t},e.axiosOptions)).data}throw new Error("Input address must be a string or array of strings.")}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async balancesForToken(t){try{const r=`${this.restURL}slp/balancesForToken/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async validateTxid(t,r=null){const i=this.restURL+"slp/validateTxid";let n;n="string"==typeof t?[t]:t;try{return(await e.axios.post(i,{txids:n,usrObj:r},e.axiosOptions)).data}catch(o){if(o.response&&o.response.data)throw o.response.data;throw o}}async validateTxid2(t){try{if(!t||""===t||"string"!=typeof t||64!==t.length)throw new Error("txid must be 64 character string.");const r=`${this.restURL}slp/validateTxid2/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;if(r.error&&r.error.indexOf("Network error")>-1)throw new Error("slp-validate timed out");throw r}}async getWhitelist(){try{const t=this.restURL+"slp/whitelist";if(0===this.whitelist.length){const r=await e.axios.get(t,e.axiosOptions);this.whitelist=r.data}return this.whitelist}catch(t){if(t.response&&t.response.data)throw t.response.data;throw t}}async validateTxid3(t,r=null){const i=this.restURL+"slp/validateTxid3";let n;n="string"==typeof t?[t]:t;try{return(await e.axios.post(i,{txids:n,usrObj:r},e.axiosOptions)).data}catch(o){if(o.response&&o.response.data)throw o.response.data;throw o}}async tokenStats(t){try{const r=`${this.restURL}slp/tokenStats/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async transactions(t,r){try{const i=`${this.restURL}slp/transactions/${t}/${r}`;return(await e.axios.get(i,e.axiosOptions)).data}catch(i){if(i.response&&i.response.data)throw i.response.data;throw i}}async burnTotal(t){try{const r=`${this.restURL}slp/burnTotal/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async txDetails(t){try{if(!t||""===t||"string"!=typeof t||64!==t.length)throw new Error("txid string must be included.");const r=`${this.restURL}slp/txDetails/${t}`;return(await e.axios.get(r,e.axiosOptions)).data}catch(r){if(r.response&&r.response.data)throw r.response.data;throw r}}async decodeOpReturn(r,i=null,n=null){if(i){if(!(i instanceof Object))throw new Error("decodeOpReturn cache parameter must be Object");const t=i[r];if(t)return t}try{if(!r||""===r||"string"!=typeof r)throw new Error("txid string must be included.");const o=this.restURL+"rawtransactions/getRawTransaction",a=(await e.axios.post(o,{verbose:!0,txids:[r],usrObj:n},e.axiosOptions)).data[0].vout[0].scriptPubKey.hex,s=e.slpParser.parseSLP(t.from(a,"hex"));let u={};return"SEND"===s.transactionType?u={tokenType:s.tokenType,txType:s.transactionType,tokenId:s.data.tokenId.toString("hex"),amounts:s.data.amounts}:"GENESIS"===s.transactionType?u={tokenType:s.tokenType,txType:s.transactionType,ticker:s.data.ticker.toString(),name:s.data.name.toString(),tokenId:r,documentUri:s.data.documentUri.toString(),documentHash:s.data.documentHash.toString(),decimals:s.data.decimals,mintBatonVout:s.data.mintBatonVout,qty:s.data.qty}:"MINT"===s.transactionType&&(u={tokenType:s.tokenType,txType:s.transactionType,tokenId:s.data.tokenId.toString("hex"),mintBatonVout:s.data.mintBatonVout,qty:s.data.qty}),i&&(i[r]=u),u}catch(o){throw o}}async tokenUtxoDetails(t,e=null){try{if(!Array.isArray(t))throw new Error("Input must be an array.");for(let e=0;e__MAX_ALLOC_330||e!=e)throw new TypeError("Bad key length")},_$defaultEncoding_329={};(function(t){var e;e=t.browser?"utf-8":t.version?parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",_$defaultEncoding_329=e}).call(this,_$browser_550);var __Buffer_332=_$safeBuffer_345.Buffer,_$toBuffer_332=function(t,e,r){if(__Buffer_332.isBuffer(t))return t;if("string"==typeof t)return __Buffer_332.from(t,e);if(ArrayBuffer.isView(t))return __Buffer_332.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},_$syncBrowser_331={},__Buffer_331=_$safeBuffer_345.Buffer,__ZEROS_331=__Buffer_331.alloc(128),__sizes_331={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function __Hmac_331(t,e,r){var i=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new _$ripemd160_344).update(t).digest()}:"md5"===t?_$md5_225:function(e){return _$shaJs_358(t).update(e).digest()}}(t),n="sha512"===t||"sha384"===t?128:64;e.length>n?e=i(e):e.lengtho(t.toString(2),"0",8)).join("")}function u(t){const e=8*t.length/32,r=_$browser_224("sha256").update(t).digest();return s(Array.from(r)).slice(0,e)}function h(t){return"mnemonic"+(t||"")}function f(e,s){if(!(s=s||r))throw new Error(i);const h=n(e).split(" ");if(h.length%3!=0)throw new Error("Invalid mnemonic");const f=h.map(t=>{const e=s.indexOf(t);if(-1===e)throw new Error("Invalid mnemonic");return o(e.toString(2),"0",11)}).join(""),c=32*Math.floor(f.length/33),l=f.slice(0,c),_=f.slice(c),d=l.match(/(.{1,8})/g).map(a);if(d.length<16)throw new Error("Invalid entropy");if(d.length>32)throw new Error("Invalid entropy");if(d.length%4!=0)throw new Error("Invalid entropy");const p=t.from(d);if(u(p)!==_)throw new Error("Invalid mnemonic checksum");return p.toString("hex")}function c(e,n){if(t.isBuffer(e)||(e=t.from(e,"hex")),!(n=n||r))throw new Error(i);if(e.length<16)throw new TypeError("Invalid entropy");if(e.length>32)throw new TypeError("Invalid entropy");if(e.length%4!=0)throw new TypeError("Invalid entropy");const o=(s(Array.from(e))+u(e)).match(/(.{1,11})/g).map(t=>{const e=a(t);return n[e]});return"\u3042\u3044\u3053\u304f\u3057\u3093"===n[0]?o.join("\u3000"):o.join(" ")}_$src_177.mnemonicToSeed=function(e,r){return Promise.resolve().then(()=>function(t,e,r,i,n){return Promise.resolve().then(()=>new Promise((r,i)=>{_$browser_327.pbkdf2(t,e,2048,64,"sha512",(t,e)=>t?i(t):r(e))}))}(t.from(n(e),"utf8"),t.from(h(n(r)),"utf8")))},_$src_177.mnemonicToEntropy=f,_$src_177.entropyToMnemonic=c,_$src_177.generateMnemonic=function(t,e,r){if((t=t||128)%32!=0)throw new TypeError("Invalid entropy");return c((e=e||_$browser_342)(t/8),r)},_$src_177.validateMnemonic=function(t,r){try{f(t,r)}catch(e){return!1}return!0},_$src_177.wordlists=_$_wordlists_176.wordlists}).call(this,_$buffer_460({}).Buffer);var _$mnemonic_18={};(function(t){const e=_$safeBuffer_345.Buffer;_$mnemonic_18=class{constructor(t){this._address=t}generate(t=128,e){return _$src_177.generateMnemonic(t,_$browser_342,e)}fromEntropy(t,e){return _$src_177.entropyToMnemonic(t,e)}toEntropy(t,r){return e.from(_$src_177.mnemonicToEntropy(t,r),"hex")}validate(t,e){const r=t.split(" ");if(0===r.length)return"Blank mnemonic";for(let i=0;i(s=i+1)&&(n=s),n>(s=r[a+1]+1)&&(n=s),r[a]=i;r[a]=n}return n},getAsync:function(e,r,i,n){if(n=function(t){const e=Array.prototype.slice.call(arguments,1);for(let r=0;r(f=a+1)&&(s=f),f=o[h+1]+1,s>f&&(s=f),o[h]=a,l=(new Date).valueOf()}if(null!==n.progress)try{n.progress.call(null,100*u/e.length)}catch(err){return i("Progress callback: "+err.toString())}var d;d=_,"function"==typeof t?t(d):setTimeout(d,0)};_()}}}).call(this,_$main_587({}).setImmediate);var _$validation_222={};function ValidationError(t){var e=new Error;this.name=e.name="ValidationError",this.message=e.message=t,this.stack=e.stack}ValidationError.prototype=Object.create(Error.prototype),_$validation_222={ValidationError:ValidationError,validate:function(t,e){if(!t)throw new ValidationError(e)}};var validate=_$validation_222.validate,CHARSET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",CHARSET_INVERSE_INDEX={q:0,p:1,z:2,r:3,y:4,9:5,x:6,8:7,g:8,f:9,2:10,t:11,v:12,d:13,w:14,0:15,s:16,3:17,j:18,n:19,5:20,4:21,k:22,h:23,c:24,e:25,6:26,m:27,u:28,a:29,7:30,l:31},_$base32_219={encode:function(t){validate(t instanceof Uint8Array,"Invalid data: "+t+".");for(var e="",r=0;r0?Math.floor(t):Math.ceil(t)}function d(t,r){var i,n,o=t.length,a=r.length,s=new Array(o),u=0,h=e;for(n=0;n=h?1:0,s[n]=i-u*h;for(;n0&&s.push(u),s}function p(t,e){return t.length>=e.length?d(t,e):d(e,t)}function m(t,r){var i,n,o=t.length,a=new Array(o),s=e;for(n=0;n0;)a[n++]=r%s,r=Math.floor(r/s);return a}function b(t,e){var r,i,n=t.length,o=e.length,a=new Array(n),s=0;for(r=0;r0;)a[n++]=u%s,u=Math.floor(u/s);return a}function w(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function M(t,r,i){return new a(t=0;--r)n=(o=1e7*n+t[r])-(i=_(o/e))*e,s[r]=0|i;return[s,0|n]}function E(t,r){var i,n,u=F(r),d=t.value,p=u.value;if(0===p)throw new Error("Cannot divide by zero");if(t.isSmall)return u.isSmall?[new s(_(d/p)),new s(d%p)]:[o[0],t];if(u.isSmall){if(1===p)return[t,o[0]];if(-1==p)return[t.negate(),o[0]];var m=Math.abs(p);if(m=0;n--){for(i=d-1,g[n+_]!==m&&(i=Math.floor((g[n+_]*d+g[n+_-1])/m)),o=0,a=0,u=v.length,s=0;su&&(n=1e7*(n+1)),r=Math.ceil(n/o);do{if(k(a=y(e,r),l)<=0)break;r--}while(r);h.push(r),l=b(l,a)}return h.reverse(),[f(h),f(l)]}(d,p))[0];var w=t.sign!==u.sign,M=i[1],S=t.sign;return"number"==typeof n?(w&&(n=-n),n=new s(n)):n=new a(n,w),"number"==typeof M?(S&&(M=-M),M=new s(M)):M=new a(M,S),[n,M]}function k(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function A(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function B(t,e){for(var r,i,n,a=t.prev(),s=a,u=0;s.isEven();)s=s.divide(2),u++;t:for(i=0;i=0?i=b(t,e):(i=b(e,t),r=!r),"number"==typeof(i=f(i))?(r&&(i=-i),new s(i)):new a(i,r)}(r,i,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){var e=F(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;return e.isSmall?new s(r-i):g(i,Math.abs(r),r>=0)},s.prototype.minus=s.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var t=this.sign,e=new s(-this.value);return e.sign=!t,e},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},a.prototype.multiply=function(t){var r,i,n,s=F(t),u=this.value,f=s.value,l=this.sign!==s.sign;if(s.isSmall){if(0===f)return o[0];if(1===f)return this;if(-1===f)return this.negate();if((r=Math.abs(f))0?function t(e,r){var i=Math.max(e.length,r.length);if(i<=30)return v(e,r);i=Math.ceil(i/2);var n=e.slice(i),o=e.slice(0,i),a=r.slice(i),s=r.slice(0,i),u=t(o,s),h=t(n,a),f=t(p(o,n),p(s,a)),l=p(p(u,w(b(b(f,u),h),i)),w(h,2*i));return c(l),l}(u,f):v(u,f),l)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(t){return u(t.value*this.value)?new s(t.value*this.value):M(Math.abs(t.value),h(Math.abs(this.value)),this.sign!==t.sign)},a.prototype._multiplyBySmall=function(t){return 0===t.value?o[0]:1===t.value?this:-1===t.value?this.negate():M(Math.abs(t.value),this.value,this.sign!==t.sign)},s.prototype.multiply=function(t){return F(t)._multiplyBySmall(this)},s.prototype.times=s.prototype.multiply,a.prototype.square=function(){return new a(S(this.value),!1)},s.prototype.square=function(){var t=this.value*this.value;return u(t)?new s(t):new a(S(h(Math.abs(this.value))),!1)},a.prototype.divmod=function(t){var e=E(this,t);return{quotient:e[0],remainder:e[1]}},s.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(t){return E(this,t)[0]},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(t){return E(this,t)[1]},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(t){var e,r,i,n=F(t),a=this.value,h=n.value;if(0===h)return o[1];if(0===a)return o[0];if(1===a)return o[1];if(-1===a)return n.isEven()?o[1]:o[-1];if(n.sign)return o[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&u(e=Math.pow(a,h)))return new s(_(e));for(r=this,i=o[1];!0&h&&(i=i.times(r),--h),0!==h;)h/=2,r=r.square();return i},s.prototype.pow=a.prototype.pow,a.prototype.modPow=function(t,e){if(t=F(t),(e=F(e)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var r=o[1],i=this.mod(e);t.isPositive();){if(i.isZero())return o[0];t.isOdd()&&(r=r.multiply(i).mod(e)),t=t.divide(2),i=i.square().mod(e)}return r},s.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(t){var e=F(t),r=this.value,i=e.value;return e.isSmall?1:k(r,i)},s.prototype.compareAbs=function(t){var e=F(t),r=Math.abs(this.value),i=e.value;return e.isSmall?r===(i=Math.abs(i))?0:r>i?1:-1:-1},a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:k(r,i)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return e.isSmall?r==i?0:r>i?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},s.prototype.compareTo=s.prototype.compare,a.prototype.equals=function(t){return 0===this.compare(t)},s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(t){return 0!==this.compare(t)},s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(t){return this.compare(t)>0},s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(t){return this.compare(t)<0},s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},a.prototype.isDivisibleBy=function(t){var e=F(t),r=e.value;return 0!==r&&(1===r||(2===r?this.isEven():this.mod(e).equals(o[0])))},s.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(t){var e=A(this);if(void 0!==e)return e;var r=this.abs(),i=r.bitLength();if(i<=64)return B(r,[2,325,9375,28178,450775,9780504,1795265022]);for(var n=Math.log(2)*i,o=Math.ceil(!0===t?2*Math.pow(n,2):n),a=[],s=0;s-r?new s(t-1):new a(i,!0)};for(var x=[1];2*x[x.length-1]<=e;)x.push(2*x[x.length-1]);var T=x.length,R=x[T-1];function P(t){return("number"==typeof t||"string"==typeof t)&&+Math.abs(t)<=e||t instanceof a&&t.value.length<=1}function I(t,e,r){e=F(e);for(var i=t.isNegative(),n=e.isNegative(),o=i?t.not():t,a=n?e.not():e,s=0,u=0,h=null,f=null,c=[];!o.isZero()||!a.isZero();)s=(h=E(o,R))[1].toJSNumber(),i&&(s=R-1-s),u=(f=E(a,R))[1].toJSNumber(),n&&(u=R-1-u),o=h[0],a=f[0],c.push(r(s,u));for(var l=0!==r(i?1:0,n?1:0)?bigInt(-1):bigInt(0),_=c.length-1;_>=0;_-=1)l=l.multiply(R).add(bigInt(c[_]));return l}a.prototype.shiftLeft=function(t){if(!P(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftRight(-t);var e=this;if(e.isZero())return e;for(;t>=T;)e=e.multiply(R),t-=T-1;return e.multiply(x[t])},s.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(t){var e;if(!P(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftLeft(-t);for(var r=this;t>=T;){if(r.isZero()||r.isNegative()&&r.isUnit())return r;r=(e=E(r,R))[1].isNegative()?e[0].prev():e[0],t-=T-1}return(e=E(r,x[t]))[1].isNegative()?e[0].prev():e[0]},s.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},s.prototype.not=a.prototype.not,a.prototype.and=function(t){return I(this,t,(function(t,e){return t&e}))},s.prototype.and=a.prototype.and,a.prototype.or=function(t){return I(this,t,(function(t,e){return t|e}))},s.prototype.or=a.prototype.or,a.prototype.xor=function(t){return I(this,t,(function(t,e){return t^e}))},s.prototype.xor=a.prototype.xor;function C(t){var r=t.value,i="number"==typeof r?r|1<<30:r[0]+r[1]*e|1073758208;return i&-i}function O(t,e){return t=F(t),e=F(e),t.greater(e)?t:e}function N(t,e){return t=F(t),e=F(e),t.lesser(e)?t:e}function L(t,e){if(t=F(t).abs(),e=F(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=o[1];t.isEven()&&e.isEven();)r=Math.min(C(t),C(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(C(t));do{for(;e.isEven();)e=e.divide(C(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}a.prototype.bitLength=function(){var t=this;return t.compareTo(bigInt(0))<0&&(t=t.negate().subtract(bigInt(1))),0===t.compareTo(bigInt(0))?bigInt(0):bigInt(function t(e,r){if(r.compareTo(e)<=0){var i=t(e,r.square(r)),n=i.p,o=i.e,a=n.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*o+1}:{p:n,e:2*o}}return{p:bigInt(1),e:0}}(t,bigInt(2)).e).add(bigInt(1))},s.prototype.bitLength=a.prototype.bitLength;var U=function(t,e){for(var r=t.length,i=Math.abs(e),o=0;o=i){if("1"===f&&1===i)continue;throw new Error(f+" is not a valid digit in base "+e+".")}if(f.charCodeAt(0)-87>=i)throw new Error(f+" is not a valid digit in base "+e+".")}if(2<=e&&e<=36&&r<=n/Math.log(e)){var a=parseInt(t,e);if(isNaN(a))throw new Error(f+" is not a valid digit in base "+e+".");return new s(parseInt(t,e))}e=F(e);var u=[],h="-"===t[0];for(o=h?1:0;o"!==t[o]);u.push(F(t.slice(l+1,o)))}}return D(u,e,h)};function D(t,e,r){var i,n=o[0],a=o[1];for(i=t.length-1;i>=0;i--)n=n.add(t[i].times(a)),a=a.times(e);return r?n.negate():n}function z(t){return t<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t):"<"+t+">"}function j(t,e){if((e=bigInt(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(+t-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.equals(1))return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+t)).map(Number.prototype.valueOf,1),isNegative:i};for(var n,o=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){n=a.divmod(e),a=n.quotient;var s=n.remainder;s.isNegative()&&(s=e.minus(s).abs(),a=a.next()),o.push(s.toJSNumber())}return o.push(a.toJSNumber()),{value:o.reverse(),isNegative:i}}function H(t,e){var r=j(t,e);return(r.isNegative?"-":"")+r.value.map(z).join("")}function q(t){if(u(+t)){var e=+t;if(e===_(e))return new s(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var i=t.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(2===i.length){var n=i[1];if("+"===n[0]&&(n=n.slice(1)),(n=+n)!==_(n)||!u(n))throw new Error("Invalid integer: "+n+" is not a valid exponent.");var o=i[0],h=o.indexOf(".");if(h>=0&&(n-=o.length-h-1,o=o.slice(0,h)+o.slice(h+1)),n<0)throw new Error("Cannot include negative exponent part for integers");t=o+=new Array(n+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);for(var f=[],l=t.length,d=l-7;l>0;)f.push(+t.slice(d,l)),(d-=7)<0&&(d=0),l-=7;return c(f),new a(f,r)}function F(t){return"number"==typeof t?function(t){if(u(t)){if(t!==_(t))throw new Error(t+" is not an integer.");return new s(t)}return q(t.toString())}(t):"string"==typeof t?q(t):t}a.prototype.toArray=function(t){return j(this,t)},s.prototype.toArray=function(t){return j(this,t)},a.prototype.toString=function(t){if(void 0===t&&(t=10),10!==t)return H(this,t);for(var e,r=this.value,i=r.length,n=String(r[--i]);--i>=0;)e=String(r[i]),n+="0000000".slice(e.length)+e;return(this.sign?"-":"")+n},s.prototype.toString=function(t){return void 0===t&&(t=10),10!=t?H(this,t):String(this.value)},a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=function(){return this.value},s.prototype.toJSNumber=s.prototype.valueOf;for(var K=0;K<1e3;K++)o[K]=new s(K),K>0&&(o[-K]=new s(-K));return o.one=o[1],o.zero=o[0],o.minusOne=o[-1],o.max=O,o.min=N,o.gcd=L,o.lcm=function(t,e){return t=F(t).abs(),e=F(e).abs(),t.divide(L(t,e)).multiply(e)},o.isInstance=function(t){return t instanceof a||t instanceof s},o.randBetween=function(t,r){var i=N(t=F(t),r=F(r)),n=O(t,r).subtract(i).add(1);if(n.isSmall)return i.add(Math.floor(Math.random()*n));for(var o=[],u=!0,h=n.value.length-1;h>=0;h--){var c=u?n.value[h]:e,l=_(Math.random()*c);o.unshift(l),l>e==0,"Invalid value: "+c+"."),u=u<=r;)h-=r,a[s]=u>>h&o,++s}return i?__validate_221(h0&&(a[s]=u<=e?i(void 0,o-n,o):(t.next(),void a()))}))}()},_$chain_35={};function DEFAULT_ADDRESS_FUNCTION(t){return t.getAddress()}function Chain(t,e,r){e=e||0,this.__parent=t,this.addresses=[],this.addressFunction=r||DEFAULT_ADDRESS_FUNCTION,this.k=e,this.map={}}Chain.prototype.__initialize=function(){var t=this.addressFunction(this.__parent.derive(this.k));this.map[t]=this.k,this.addresses.push(t)},Chain.prototype.clone=function(){var t=new Chain(this.__parent,this.k,this.addressFunction);for(var e in t.addresses=this.addresses.concat(),this.map)t.map[e]=this.map[e];return t},Chain.prototype.derive=function(t,e){var r=this.map[t];if(void 0!==r)return(e=e||this.__parent).derive(r)},Chain.prototype.find=function(t){return this.map[t]},Chain.prototype.get=function(){return 0===this.addresses.length&&this.__initialize(),this.addresses[this.addresses.length-1]},Chain.prototype.getAll=function(){return 0===this.addresses.length&&this.__initialize(),this.addresses},Chain.prototype.getParent=function(){return this.__parent},Chain.prototype.next=function(){0===this.addresses.length&&this.__initialize();var t=this.addressFunction(this.__parent.derive(this.k+1));return this.k+=1,this.map[t]=this.k,this.addresses.push(t),t},Chain.prototype.pop=function(){var t=this.addresses.pop();return delete this.map[t],this.k-=1,t},_$chain_35=Chain;var _$account_34={};function Account(t){this.chains=t}Account.fromJSON=function(t,e,r){},Account.prototype.clone=function(){return new Account(this.chains.map((function(t){return t.clone()})))},Account.prototype.containsAddress=function(t){return this.chains.some((function(e){return void 0!==e.find(t)}))},Account.prototype.derive=function(t,e){var r;return this.chains.some((function(i,n){return r=i.derive(t,e&&e[n])})),r},Account.prototype.discoverChain=function(t,e,r,i){var n=this.chains,o=n[t].clone();_$discovery_36(o,e,r,(function(e,r,a){if(e)return i(e);for(var s=a-r,u=1;u0?Math.floor(t):Math.ceil(t)}function p(t,r){var i,n,o=t.length,a=r.length,s=new Array(o),u=0,h=e;for(n=0;n=h?1:0,s[n]=i-u*h;for(;n0&&s.push(u),s}function m(t,e){return t.length>=e.length?p(t,e):p(e,t)}function b(t,r){var i,n,o=t.length,a=new Array(o),s=e;for(n=0;n0;)a[n++]=r%s,r=Math.floor(r/s);return a}function g(t,e){var r,i,n=t.length,o=e.length,a=new Array(n),s=0;for(r=0;r0;)a[n++]=u%s,u=Math.floor(u/s);return a}function M(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function S(t,r,i){return new a(t=0;--r)n=(o=1e7*n+t[r])-(i=d(o/e))*e,s[r]=0|i;return[s,0|n]}function k(t,r){var i,h=F(r);if(n)return[new u(t.value/h.value),new u(t.value%h.value)];var p,m=t.value,b=h.value;if(0===b)throw new Error("Cannot divide by zero");if(t.isSmall)return h.isSmall?[new s(d(m/b)),new s(m%b)]:[o[0],t];if(h.isSmall){if(1===b)return[t,o[0]];if(-1==b)return[t.negate(),o[0]];var v=Math.abs(b);if(v=0;n--){for(i=d-1,g[n+l]!==m&&(i=Math.floor((g[n+l]*d+g[n+l-1])/m)),o=0,a=0,u=v.length,s=0;su&&(n=1e7*(n+1)),r=Math.ceil(n/o);do{if(A(a=w(e,r),f)<=0)break;r--}while(r);h.push(r),f=g(f,a)}return h.reverse(),[c(h),c(f)]}(m,b))[0];var S=t.sign!==h.sign,$=i[1],k=t.sign;return"number"==typeof p?(S&&(p=-p),p=new s(p)):p=new a(p,S),"number"==typeof $?(k&&($=-$),$=new s($)):$=new a($,k),[p,$]}function A(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function B(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function x(t,e){for(var r,i,n,o=t.prev(),a=o,s=0;a.isEven();)a=a.divide(2),s++;t:for(i=0;i=0?i=g(t,e):(i=g(e,t),r=!r),"number"==typeof(i=c(i))?(r&&(i=-i),new s(i)):new a(i,r)}(r,i,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){var e=F(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;return e.isSmall?new s(r-i):v(i,Math.abs(r),r>=0)},s.prototype.minus=s.prototype.subtract,u.prototype.subtract=function(t){return new u(this.value-F(t).value)},u.prototype.minus=u.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var t=this.sign,e=new s(-this.value);return e.sign=!t,e},u.prototype.negate=function(){return new u(-this.value)},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},u.prototype.abs=function(){return new u(this.value>=0?this.value:-this.value)},a.prototype.multiply=function(t){var r,i,n,s=F(t),u=this.value,h=s.value,c=this.sign!==s.sign;if(s.isSmall){if(0===h)return o[0];if(1===h)return this;if(-1===h)return this.negate();if((r=Math.abs(h))0?function t(e,r){var i=Math.max(e.length,r.length);if(i<=30)return y(e,r);i=Math.ceil(i/2);var n=e.slice(i),o=e.slice(0,i),a=r.slice(i),s=r.slice(0,i),u=t(o,s),h=t(n,a),f=t(m(o,n),m(s,a)),c=m(m(u,M(g(g(f,u),h),i)),M(h,2*i));return l(c),c}(u,h):y(u,h),c)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(t){return h(t.value*this.value)?new s(t.value*this.value):S(Math.abs(t.value),f(Math.abs(this.value)),this.sign!==t.sign)},a.prototype._multiplyBySmall=function(t){return 0===t.value?o[0]:1===t.value?this:-1===t.value?this.negate():S(Math.abs(t.value),this.value,this.sign!==t.sign)},s.prototype.multiply=function(t){return F(t)._multiplyBySmall(this)},s.prototype.times=s.prototype.multiply,u.prototype.multiply=function(t){return new u(this.value*F(t).value)},u.prototype.times=u.prototype.multiply,a.prototype.square=function(){return new a($(this.value),!1)},s.prototype.square=function(){var t=this.value*this.value;return h(t)?new s(t):new a($(f(Math.abs(this.value))),!1)},u.prototype.square=function(t){return new u(this.value*this.value)},a.prototype.divmod=function(t){var e=k(this,t);return{quotient:e[0],remainder:e[1]}},u.prototype.divmod=s.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(t){return k(this,t)[0]},u.prototype.over=u.prototype.divide=function(t){return new u(this.value/F(t).value)},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(t){return k(this,t)[1]},u.prototype.mod=u.prototype.remainder=function(t){return new u(this.value%F(t).value)},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(t){var e,r,i,n=F(t),a=this.value,u=n.value;if(0===u)return o[1];if(0===a)return o[0];if(1===a)return o[1];if(-1===a)return n.isEven()?o[1]:o[-1];if(n.sign)return o[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&h(e=Math.pow(a,u)))return new s(d(e));for(r=this,i=o[1];!0&u&&(i=i.times(r),--u),0!==u;)u/=2,r=r.square();return i},s.prototype.pow=a.prototype.pow,u.prototype.pow=function(t){var e=F(t),r=this.value,i=e.value,n=BigInt(0),a=BigInt(1),s=BigInt(2);if(i===n)return o[1];if(r===n)return o[0];if(r===a)return o[1];if(r===BigInt(-1))return e.isEven()?o[1]:o[-1];if(e.isNegative())return new u(n);for(var h=this,f=o[1];(i&a)===a&&(f=f.times(h),--i),i!==n;)i/=s,h=h.square();return f},a.prototype.modPow=function(t,e){if(t=F(t),(e=F(e)).isZero())throw new Error("Cannot take modPow with modulus 0");var r=o[1],i=this.mod(e);for(t.isNegative()&&(t=t.multiply(o[-1]),i=i.modInv(e));t.isPositive();){if(i.isZero())return o[0];t.isOdd()&&(r=r.multiply(i).mod(e)),t=t.divide(2),i=i.square().mod(e)}return r},u.prototype.modPow=s.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(t){var e=F(t),r=this.value,i=e.value;return e.isSmall?1:A(r,i)},s.prototype.compareAbs=function(t){var e=F(t),r=Math.abs(this.value),i=e.value;return e.isSmall?r===(i=Math.abs(i))?0:r>i?1:-1:-1},u.prototype.compareAbs=function(t){var e=this.value,r=F(t).value;return(e=e>=0?e:-e)===(r=r>=0?r:-r)?0:e>r?1:-1},a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:A(r,i)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=F(t),r=this.value,i=e.value;return e.isSmall?r==i?0:r>i?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},s.prototype.compareTo=s.prototype.compare,u.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=this.value,r=F(t).value;return e===r?0:e>r?1:-1},u.prototype.compareTo=u.prototype.compare,a.prototype.equals=function(t){return 0===this.compare(t)},u.prototype.eq=u.prototype.equals=s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(t){return 0!==this.compare(t)},u.prototype.neq=u.prototype.notEquals=s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(t){return this.compare(t)>0},u.prototype.gt=u.prototype.greater=s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(t){return this.compare(t)<0},u.prototype.lt=u.prototype.lesser=s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},u.prototype.geq=u.prototype.greaterOrEquals=s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},u.prototype.leq=u.prototype.lesserOrEquals=s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},u.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},u.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},u.prototype.isPositive=s.prototype.isPositive,a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},u.prototype.isNegative=s.prototype.isNegative,a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},u.prototype.isUnit=function(){return this.abs().value===BigInt(1)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},u.prototype.isZero=function(){return this.value===BigInt(0)},a.prototype.isDivisibleBy=function(t){var e=F(t);return!e.isZero()&&(!!e.isUnit()||(0===e.compareAbs(2)?this.isEven():this.mod(e).isZero()))},u.prototype.isDivisibleBy=s.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(t){var e=B(this);if(void 0!==e)return e;var r=this.abs(),i=r.bitLength();if(i<=64)return x(r,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var n=Math.log(2)*i.toJSNumber(),o=Math.ceil(!0===t?2*Math.pow(n,2):n),a=[],s=0;s-r?new s(t-1):new a(i,!0)},u.prototype.prev=function(){return new u(this.value-BigInt(1))};for(var T=[1];2*T[T.length-1]<=e;)T.push(2*T[T.length-1]);var R=T.length,P=T[R-1];function I(t){return Math.abs(t)<=e}function C(t,e,r){e=F(e);for(var i=t.isNegative(),n=e.isNegative(),o=i?t.not():t,a=n?e.not():e,s=0,u=0,h=null,f=null,c=[];!o.isZero()||!a.isZero();)s=(h=k(o,P))[1].toJSNumber(),i&&(s=P-1-s),u=(f=k(a,P))[1].toJSNumber(),n&&(u=P-1-u),o=h[0],a=f[0],c.push(r(s,u));for(var l=0!==r(i?1:0,n?1:0)?__bigInt_162(-1):__bigInt_162(0),_=c.length-1;_>=0;_-=1)l=l.multiply(P).add(__bigInt_162(c[_]));return l}a.prototype.shiftLeft=function(t){var e=F(t).toJSNumber();if(!I(e))throw new Error(String(e)+" is too large for shifting.");if(e<0)return this.shiftRight(-e);var r=this;if(r.isZero())return r;for(;e>=R;)r=r.multiply(P),e-=R-1;return r.multiply(T[e])},u.prototype.shiftLeft=s.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(t){var e,r=F(t).toJSNumber();if(!I(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var i=this;r>=R;){if(i.isZero()||i.isNegative()&&i.isUnit())return i;i=(e=k(i,P))[1].isNegative()?e[0].prev():e[0],r-=R-1}return(e=k(i,T[r]))[1].isNegative()?e[0].prev():e[0]},u.prototype.shiftRight=s.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},u.prototype.not=s.prototype.not=a.prototype.not,a.prototype.and=function(t){return C(this,t,(function(t,e){return t&e}))},u.prototype.and=s.prototype.and=a.prototype.and,a.prototype.or=function(t){return C(this,t,(function(t,e){return t|e}))},u.prototype.or=s.prototype.or=a.prototype.or,a.prototype.xor=function(t){return C(this,t,(function(t,e){return t^e}))},u.prototype.xor=s.prototype.xor=a.prototype.xor;function O(t){var r=t.value,i="number"==typeof r?r|1<<30:"bigint"==typeof r?r|BigInt(1<<30):r[0]+r[1]*e|1073758208;return i&-i}function N(t,e){return t=F(t),e=F(e),t.greater(e)?t:e}function L(t,e){return t=F(t),e=F(e),t.lesser(e)?t:e}function U(t,e){if(t=F(t).abs(),e=F(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=o[1];t.isEven()&&e.isEven();)r=L(O(t),O(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(O(t));do{for(;e.isEven();)e=e.divide(O(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}a.prototype.bitLength=function(){var t=this;return t.compareTo(__bigInt_162(0))<0&&(t=t.negate().subtract(__bigInt_162(1))),0===t.compareTo(__bigInt_162(0))?__bigInt_162(0):__bigInt_162(function t(e,r){if(r.compareTo(e)<=0){var i=t(e,r.square(r)),n=i.p,o=i.e,a=n.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*o+1}:{p:n,e:2*o}}return{p:__bigInt_162(1),e:0}}(t,__bigInt_162(2)).e).add(__bigInt_162(1))},u.prototype.bitLength=s.prototype.bitLength=a.prototype.bitLength;var D=function(t,e,r,i){r=r||"0123456789abcdefghijklmnopqrstuvwxyz",t=String(t),i||(t=t.toLowerCase(),r=r.toLowerCase());var n,o=t.length,a=Math.abs(e),s={};for(n=0;n=a){if("1"===f&&1===a)continue;throw new Error(f+" is not a valid digit in base "+e+".")}e=F(e);var u=[],h="-"===t[0];for(n=h?1:0;n"!==t[n]&&n=0;i--)n=n.add(t[i].times(a)),a=a.times(e);return r?n.negate():n}function j(t,e){if((e=__bigInt_162(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(t.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.isUnit())return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(t.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:i};for(var n,o=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){n=a.divmod(e),a=n.quotient;var s=n.remainder;s.isNegative()&&(s=e.minus(s).abs(),a=a.next()),o.push(s.toJSNumber())}return o.push(a.toJSNumber()),{value:o.reverse(),isNegative:i}}function H(t,e,r){var i=j(t,e);return(i.isNegative?"-":"")+i.value.map((function(t){return function(t,e){return t<(e=e||"0123456789abcdefghijklmnopqrstuvwxyz").length?e[t]:"<"+t+">"}(t,r)})).join("")}function q(t){if(h(+t)){var e=+t;if(e===d(e))return n?new u(BigInt(e)):new s(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var i=t.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(2===i.length){var o=i[1];if("+"===o[0]&&(o=o.slice(1)),(o=+o)!==d(o)||!h(o))throw new Error("Invalid integer: "+o+" is not a valid exponent.");var f=i[0],c=f.indexOf(".");if(c>=0&&(o-=f.length-c-1,f=f.slice(0,c)+f.slice(c+1)),o<0)throw new Error("Cannot include negative exponent part for integers");t=f+=new Array(o+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);if(n)return new u(BigInt(r?"-"+t:t));for(var _=[],p=t.length,m=p-7;p>0;)_.push(+t.slice(m,p)),(m-=7)<0&&(m=0),p-=7;return l(_),new a(_,r)}function F(t){return"number"==typeof t?function(t){if(n)return new u(BigInt(t));if(h(t)){if(t!==d(t))throw new Error(t+" is not an integer.");return new s(t)}return q(t.toString())}(t):"string"==typeof t?q(t):"bigint"==typeof t?new u(t):t}a.prototype.toArray=function(t){return j(this,t)},s.prototype.toArray=function(t){return j(this,t)},u.prototype.toArray=function(t){return j(this,t)},a.prototype.toString=function(t,e){if(void 0===t&&(t=10),10!==t)return H(this,t,e);for(var r,i=this.value,n=i.length,o=String(i[--n]);--n>=0;)r=String(i[n]),o+="0000000".slice(r.length)+r;return(this.sign?"-":"")+o},s.prototype.toString=function(t,e){return void 0===t&&(t=10),10!=t?H(this,t,e):String(this.value)},u.prototype.toString=s.prototype.toString,u.prototype.toJSON=a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=function(){return this.value},s.prototype.toJSNumber=s.prototype.valueOf,u.prototype.valueOf=u.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var K=0;K<1e3;K++)o[K]=F(K),K>0&&(o[-K]=F(-K));return o.one=o[1],o.zero=o[0],o.minusOne=o[-1],o.max=N,o.min=L,o.gcd=U,o.lcm=function(t,e){return t=F(t).abs(),e=F(e).abs(),t.divide(U(t,e)).multiply(e)},o.isInstance=function(t){return t instanceof a||t instanceof s||t instanceof u},o.randBetween=function(t,r,i){t=F(t),r=F(r);var n=i||Math.random,a=L(t,r),s=N(t,r).subtract(a).add(1);if(s.isSmall)return a.add(Math.floor(n()*s));for(var u=j(s,e).value,h=[],f=!0,c=0;c>e==0,"Invalid value: "+c+"."),u=u<=r;)h-=r,a[s]=u>>h&o,++s}return i?__validate_216(h0&&(a[s]=u<new _$bip32Utils_37.Chain(t.neutered()));return new _$bip32Utils_37.Account(e)}createChain(t){return new _$bip32Utils_37.Chain(t)}};const SEQUENCE_FINAL=4294967295,SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,SEQUENCE_LOCKTIME_GRANULARITY=9,SEQUENCE_LOCKTIME_MASK=65535,SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,BLOCKS_MAX=SEQUENCE_LOCKTIME_MASK,SECONDS_MOD=1<SECONDS_MAX)throw new TypeError("Expected Number seconds <= "+SECONDS_MAX);if(r%SECONDS_MOD!=0)throw new TypeError("Expected Number seconds as a multiple of "+SECONDS_MOD);return SEQUENCE_LOCKTIME_TYPE_FLAG|r>>SEQUENCE_LOCKTIME_GRANULARITY}if(!Number.isFinite(e))throw new TypeError("Expected Number blocks");if(e>SEQUENCE_LOCKTIME_MASK)throw new TypeError("Expected Number blocks <= "+BLOCKS_MAX);return e}};class __TransactionBuilder_30{static setAddress(t){__TransactionBuilder_30._address=t}constructor(t="mainnet"){let e;const r=(e="bitcoincash"===t||"mainnet"===t?_$coininfo_79.bitcoincash.main:_$coininfo_79.bitcoincash.test).toBitcoinJS();this.transaction=new _$src_48.TransactionBuilder(r),this.DEFAULT_SEQUENCE=4294967295,this.hashTypes={SIGHASH_ALL:1,SIGHASH_NONE:2,SIGHASH_SINGLE:3,SIGHASH_ANYONECANPAY:128,SIGHASH_BITCOINCASH_BIP143:64,ADVANCED_TRANSACTION_MARKER:0,ADVANCED_TRANSACTION_FLAG:1},this.signatureAlgorithms={ECDSA:_$src_48.ECSignature.ECDSA,SCHNORR:_$src_48.ECSignature.SCHNORR},this.bip66=_$bip66_187,this.bip68=_$bcBip68_158,this.p2shInput=!1}addInput(t,e,r=this.DEFAULT_SEQUENCE,i){this.transaction.addInput(t,e,r,i)}addInputScript(t,e){this.tx=this.transaction.buildIncomplete(),this.tx.setInputScript(t,e),this.p2shInput=!0}addInputScripts(t){this.tx=this.transaction.buildIncomplete(),t.forEach(t=>{this.tx.setInputScript(t.vout,t.script)}),this.p2shInput=!0}addOutput(t,e){try{this.transaction.addOutput(__TransactionBuilder_30._address.toLegacyAddress(t),e)}catch(r){this.transaction.addOutput(t,e)}}setLockTime(t){this.transaction.setLockTime(t)}sign(t,e,r,i=this.hashTypes.SIGHASH_ALL,n,o){this.transaction.sign(t,e,r,i,n,void 0,o)}build(){return!0===this.p2shInput?this.tx:this.transaction.build()}}var _$TransactionBuilder_30=__TransactionBuilder_30;class __ECPair_11{static setAddress(t){__ECPair_11._address=t}static fromWIF(t){let e,r;"L"===t[0]||"K"===t[0]?e="mainnet":"c"===t[0]&&(e="testnet");const i=(r="mainnet"===e?_$coininfo_79.bitcoincash.main:_$coininfo_79.bitcoincash.test).toBitcoinJS();return _$src_48.ECPair.fromWIF(t,i)}static toWIF(t){return t.toWIF()}static sign(t,e){return t.sign(e)}static verify(t,e,r){return t.verify(e,r)}static fromPublicKey(t){return _$src_48.ECPair.fromPublicKeyBuffer(t)}static toPublicKey(t){return t.getPublicKeyBuffer()}static toLegacyAddress(t){return t.getAddress()}static toCashAddress(t,e=!1){return __ECPair_11._address.toCashAddress(t.getAddress(),!0,e)}}var _$ECPair_11=__ECPair_11,_$script_23=class{constructor(){this.opcodes=_$index_38,this.nullData=_$src_48.script.nullData,this.multisig={input:{encode:t=>{const e=[];return t.forEach(t=>{e.push(t)}),_$src_48.script.multisig.input.encode(e)},decode:_$src_48.script.multisig.input.decode,check:_$src_48.script.multisig.input.check},output:{encode:(t,e)=>{const r=[];return e.forEach(t=>{r.push(t)}),_$src_48.script.multisig.output.encode(t,r)},decode:_$src_48.script.multisig.output.decode,check:_$src_48.script.multisig.output.check}},this.pubKey=_$src_48.script.pubKey,this.pubKeyHash=_$src_48.script.pubKeyHash,this.scriptHash=_$src_48.script.scriptHash}classifyInput(t){return _$src_48.script.classifyInput(t)}classifyOutput(t){return _$src_48.script.classifyOutput(t)}decode(t){return _$src_48.script.decompile(t)}encode(t){const e=[];return t.forEach(t=>{e.push(t)}),_$src_48.script.compile(e)}encode2(t){const e=[];return t.forEach(t=>{e.push(t)}),_$src_48.script.compile2(e)}toASM(t){return _$src_48.script.toASM(t)}fromASM(t){return _$src_48.script.fromASM(t)}};let ___this_20;var _$price_20=class{constructor(t){___this_20=this,this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.axios=_$axios_130}async current(t="usd"){try{return(await this.axios.get("https://index-api.bitcoin.com/api/v0/cash/price/"+t.toLowerCase())).data.price}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getUsd(){try{return(await this.axios.get(this.restURL+"price/usd",___this_20.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}async rates(){try{return(await this.axios.get(this.restURL+"price/rates",___this_20.axiosOptions)).data}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getBchaUsd(){try{return(await this.axios.get(this.restURL+"price/bchausd",___this_20.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}},_$randomBytes_341={};(function(t){"use strict";var r=_$cryptoBrowserify_469({}),i=r.randomBytes===r.pseudoRandomBytes?1:3;function n(t,e,i){r.randomBytes(t,(function(r,o){return r?--e?void setTimeout(n.bind(null,t,e,i),10):i(r):i(null,o)}))}(_$randomBytes_341=function(e,r){if(void 0!==r&&"function"!=typeof r)throw new TypeError("argument callback must be a function");if(!r&&!t.Promise)throw new TypeError("argument callback is required");return r?n(e,i,r):new Promise((function(t,r){n(e,i,(function(e,i){if(e)return r(e);t(i)}))}))}).sync=function(t){for(var n=null,o=0;o0)throw new Error(t+" must be an integer in the range 1..n-1")}var _$check_169={checkSessionParams:function(t,e,r,i,n){checkSignParams(e,r),checkBuffer("sessionId",t,32),checkBuffer("pubKeyCombined",i,33),checkBuffer("ell",n,32)},checkSignParams:checkSignParams,checkVerifyParams:function(t,e,r){checkBuffer("pubKey",t,33),checkBuffer("message",e,32),checkBuffer("signature",r,64)},checkBatchVerifyParams:function(t,e,r){if(checkPubKeyArr(t),function(t){checkArray("messages",t);for(let e=0;e=0)throw new Error("r is larger than or equal to field size");if(e.compareTo(n)>=0)throw new Error("s is larger than or equal to curve order")},checkPointExists:function(t,e){if(e.curve.isInfinity(e))throw new Error("point is at infinity");if(t!==e.affineY.isEven())throw new Error("point does not exist")},checkPubKeyArr:checkPubKeyArr,checkPubKeysUnique:function(t){const e=t.map(t=>t.toString("hex"));if(t.length!==e.filter((t,e,r)=>r.indexOf(t)===e).length)throw new Error("pubKeys must be an array with unique elements")},checkArray:checkArray,checkNonceArr:function(t){checkArray("nonces",t);for(let e=0;e>6,a[u++]=128|63&o):o<55296||o>=57344?(a[u++]=224|o>>12,a[u++]=128|o>>6&63,a[u++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++i)),a[u++]=240|o>>18,a[u++]=128|o>>12&63,a[u++]=128|o>>6&63,a[u++]=128|63&o);t=a}else{if("object"!==n)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR)}t.length>64&&(t=new Sha256(e,!0).update(t).array());var h=[],f=[];for(i=0;i<64;++i){var c=t[i]||0;h[i]=92^c,f[i]=54^c}Sha256.call(this,e,r),this.update(f),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR);e=!0}for(var i,n,o=0,a=t.length,s=this.blocks;o>2]|=t[o]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[n>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=64?(this.block=s[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t,e,r,i,n,o,a,s,u,h=this.h0,f=this.h1,c=this.h2,l=this.h3,_=this.h4,d=this.h5,p=this.h6,m=this.h7,b=this.blocks;for(t=16;t<64;++t)e=((n=b[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=b[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,b[t]=b[t-16]+e+b[t-7]+r<<0;for(u=f&c,t=0;t<64;t+=4)this.first?(this.is224?(o=300032,m=(n=b[0]-1413257819)-150054599<<0,l=n+24177077<<0):(o=704751109,m=(n=b[0]-210244248)-1521486534<<0,l=n+143694565<<0),this.first=!1):(e=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(o=h&f)^h&c^u,m=l+(n=m+(r=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&d^~_&p)+K[t]+b[t])<<0,l=n+(e+i)<<0),e=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),i=(a=l&h)^l&f^o,p=c+(n=p+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&_^~m&d)+K[t+1]+b[t+1])<<0,e=((c=n+(e+i)<<0)>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),i=(s=c&l)^c&h^a,d=f+(n=d+(r=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&m^~p&_)+K[t+2]+b[t+2])<<0,e=((f=n+(e+i)<<0)>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),i=(u=f&c)^f&l^s,_=h+(n=_+(r=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&p^~d&m)+K[t+3]+b[t+3])<<0,h=n+(e+i)<<0;this.h0=this.h0+h<<0,this.h1=this.h1+f<<0,this.h2=this.h2+c<<0,this.h3=this.h3+l<<0,this.h4=this.h4+_<<0,this.h5=this.h5+d<<0,this.h6=this.h6+p<<0,this.h7=this.h7+m<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,o=this.h5,a=this.h6,s=this.h7,u=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a];return this.is224||(u+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),u},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,o=this.h5,a=this.h6,s=this.h7,u=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||u.push(s>>24&255,s>>16&255,s>>8&255,255&s),u},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?_$sha256_319.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define((function(){return exports})))}()}).call(this,_$browser_550,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$sha256_319=_$sha256_319.exports;const __Buffer_170=_$safeBuffer_345.Buffer,__curve_170=_$lib_268.getCurveByName("secp256k1");function bufferToInt(t){return _$lib_166.fromBuffer(t)}var _$convert_170={bufferToInt:bufferToInt,intToBuffer:function(t){return t.toBuffer(32)},hash:function(t){return __Buffer_170.from(_$sha256_319.create().update(t).array())},pointToBuffer:function(t){return t.getEncoded(!0)},pubKeyToPoint:function(t){const e=t[0]-2==0,r=bufferToInt(t.slice(1,33)),i=__curve_170.pointFromX(!e,r);return _$check_169.checkPointExists(e,i),i}};const __Buffer_172=_$safeBuffer_345.Buffer,__curve_172=_$lib_268.getCurveByName("secp256k1"),__concat_172=__Buffer_172.concat,__G_172=__curve_172.G,__p_172=__curve_172.p,__n_172=__curve_172.n,__one_172=_$lib_166.ONE,__two_172=_$lib_166.valueOf(2);function jacobi(t){return t.modPow(__p_172.subtract(__one_172).divide(__two_172),__p_172).intValue()}var _$math_172={deterministicGetK0:function(t,e){_$check_169.checkSignParams(t,e);const r=_$convert_170.hash(__concat_172([_$convert_170.intToBuffer(t),e])),i=_$convert_170.bufferToInt(r).mod(__n_172);if(0===i.signum())throw new Error("k0 is zero");return i},jacobi:jacobi,getK:function(t,e){return 1===jacobi(t.affineY)?e:__n_172.subtract(e)},getE:function(t,e,r){return _$convert_170.bufferToInt(_$convert_170.hash(__concat_172([t,_$convert_170.pointToBuffer(e),r]))).mod(__n_172)},getR:function(t,e,r){const i=__G_172.multiply(t),n=r.multiply(e);return i.add(n.negate())},randomA:function(){let t=null;for(;;){t=_$convert_170.bufferToInt(__Buffer_172.from(_$randomBytes_341.sync(32)));try{return _$check_169.checkRange("a",t),t}catch(e){}}}};const __Buffer_174=_$safeBuffer_345.Buffer,__curve_174=_$lib_268.getCurveByName("secp256k1"),__concat_174=__Buffer_174.concat,__G_174=__curve_174.G,__p_174=__curve_174.p,__n_174=__curve_174.n,zero=_$lib_166.ZERO,__one_174=_$lib_166.ONE,__two_174=_$lib_166.valueOf(2),three=_$lib_166.valueOf(3),four=_$lib_166.valueOf(4),seven=_$lib_166.valueOf(7);var _$schnorr_174={sign:function(t,e){const r=_$math_172.deterministicGetK0(t,e),i=__G_174.multiply(r),n=_$math_172.getK(i,r),o=__G_174.multiply(t),a=_$convert_170.intToBuffer(i.affineX),s=_$math_172.getE(a,o,e);return __concat_174([a,_$convert_170.intToBuffer(n.add(s.multiply(t)).mod(__n_174))])},verify:function(t,e,r){_$check_169.checkVerifyParams(t,e,r);const i=_$convert_170.pubKeyToPoint(t),n=_$convert_170.bufferToInt(r.slice(0,32)),o=_$convert_170.bufferToInt(r.slice(32,64));_$check_169.checkSignatureInput(n,o);const a=_$math_172.getE(_$convert_170.intToBuffer(n),i,e),s=_$math_172.getR(o,a,i);if(s.curve.isInfinity(s)||1!==_$math_172.jacobi(s.affineY)||!s.affineX.equals(n))throw new Error("signature verification failed")},batchVerify:function(t,e,r){_$check_169.checkBatchVerifyParams(t,e,r);let i=zero,n=null;for(let o=0;o{if(0===e.length)return t.from(Uint8Array.from([76,0]));if(e.length<78)return t.concat([Uint8Array.from([e.length]),e]);if(e.length<255)return t.concat([Uint8Array.from([76,e.length]),e]);if(e.length<65535){const r=t.allocUnsafe(2);return r.writeUInt16LE(e.length,0),t.concat([Uint8Array.from([77]),r,e])}if(e.length<4294967295){const r=t.allocUnsafe(4);return r.writeUInt32LE(e.length,0),t.concat([Uint8Array.from([78]),r,e])}throw new Error("does not support bigger pushes yet")},_$util_368.BNToInt64BE=e=>{if(!e.isInteger())throw new Error("bn not an integer");if(!e.isPositive())throw new Error("bn not positive integer");const r=e.toString(16);if(r.length>16)throw new Error("bn outside of range");return t.from(r.padStart(16,"0"),"hex")},_$util_368.createOpReturnGenesis=(e,r,i,n,o,a,s,u)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof o){if(0!==o.length&&64!==o.length)throw new Error("documentHash must be either 0 or 32 hex bytes");if(64===o.length&&!o.match(/^[0-9a-fA-F]{64}$/))throw new Error("documentHash must be hex");o=t.from(o,"hex")}else if(0!==o.length&&32!==o.length)throw new Error("documentHash must be either 0 or 32 hex bytes");if(a<0||a>9)throw new Error("decimals out of range");if(null!==s&&(s<2||s>255))throw new Error("mintBatonVout out of range (0x02 < > 0xFF)");if(65===e){if(!u.isEqualTo(1))throw new Error("quantity must be 1 for NFT1 child genesis");if(0!==a)throw new Error("decimals must be 0 for NFT1 child genesis");if(null!==s)throw new Error("mintBatonVout must be null for NFT1 child genesis")}return t.concat([Uint8Array.from([106]),_$util_368.pushdata(t.from("SLP\0")),_$util_368.pushdata(Uint8Array.from([e])),_$util_368.pushdata(t.from("GENESIS")),_$util_368.pushdata(t.from(r)),_$util_368.pushdata(t.from(i)),_$util_368.pushdata(t.from(n)),_$util_368.pushdata(o),_$util_368.pushdata(Uint8Array.from([a])),_$util_368.pushdata(Uint8Array.from(null===s?[]:[s])),_$util_368.pushdata(_$util_368.BNToInt64BE(u))])},_$util_368.createOpReturnMint=(e,r,i,n)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof r){if(!r.match(/^[0-9a-fA-F]{64}$/))throw new Error("tokenIdHex does not pass regex");if(64!==r.length)throw new Error("tokenIdHex must be 32 bytes");r=t.from(r,"hex")}else if(32!==r.length)throw new Error("tokenIdHex must be 32 bytes");if(null!==i&&(i<2||i>255))throw new Error("mintBatonVout out of range (0x02 < > 0xFF)");return t.concat([Uint8Array.from([106]),_$util_368.pushdata(t.from("SLP\0")),_$util_368.pushdata(Uint8Array.from([e])),_$util_368.pushdata(t.from("MINT")),_$util_368.pushdata(r),_$util_368.pushdata(Uint8Array.from(null===i?[]:[i])),_$util_368.pushdata(_$util_368.BNToInt64BE(n))])},_$util_368.createOpReturnSend=(e,r,i)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof r){if(!r.match(/^[0-9a-fA-F]{64}$/))throw new Error("tokenIdHex does not pass regex");if(64!==r.length)throw new Error("tokenIdHex must be 32 bytes");r=t.from(r,"hex")}else if(32!==r.length)throw new Error("tokenIdHex must be 32 bytes");if(i.length<1)throw new Error("send requires at least one amount");if(i.length>19)throw new Error("too many slp amounts");return t.concat([Uint8Array.from([106]),_$util_368.pushdata(t.from("SLP\0")),_$util_368.pushdata(Uint8Array.from([e])),_$util_368.pushdata(t.from("SEND")),_$util_368.pushdata(r),...i.map(t=>_$util_368.pushdata(_$util_368.BNToInt64BE(t)))])}}).call(this,_$buffer_460({}).Buffer);var _$tokentype1_367={};Object.defineProperty(_$tokentype1_367,"__esModule",{value:!0}),_$tokentype1_367.default={genesis:(t,e,r,i,n,o,a)=>_$util_368.createOpReturnGenesis(1,t,e,r,i,n,o,a),mint:(t,e,r)=>_$util_368.createOpReturnMint(1,t,e,r),send:(t,e)=>_$util_368.createOpReturnSend(1,t,e)};var _$nft1_366={},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$nft1_366,"__esModule",{value:!0});const bignumber_js_1=__importDefault(_$bignumber_168);_$nft1_366.default={Group:{genesis:(t,e,r,i,n,o,a)=>_$util_368.createOpReturnGenesis(129,t,e,r,i,n,o,a),mint:(t,e,r)=>_$util_368.createOpReturnMint(129,t,e,r),send:(t,e)=>_$util_368.createOpReturnSend(129,t,e)},Child:{genesis:(t,e,r,i)=>_$util_368.createOpReturnGenesis(65,t,e,r,i,0,null,new bignumber_js_1.default(1)),send:(t,e)=>_$util_368.createOpReturnSend(65,t,e)}};var _$dist_365={},____importDefault_365=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$dist_365,"__esModule",{value:!0});const __bignumber_js_1_365=____importDefault_365(_$bignumber_168);_$dist_365.BN=__bignumber_js_1_365.default;const tokentype1_1=____importDefault_365(_$tokentype1_367);_$dist_365.TokenType1=tokentype1_1.default;const nft1_1=____importDefault_365(_$nft1_366);let addy,___this_28;_$dist_365.NFT1=nft1_1.default;var _$tokentype1_28=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},addy=new _$address_24(t),this.Script=new _$script_23,this.axios=_$axios_130,_$TransactionBuilder_30.setAddress(addy),___this_28=this}generateSendOpReturn(t,e){try{const r=t[0].tokenId,i=t[0].decimals,n=new _$bignumber_168(e).times(10**i),o=t.reduce((t,e)=>t.plus(new _$bignumber_168(e.tokenQty).times(10**i)),new _$bignumber_168(0)),a=o.minus(n);let s,u=1;if(a>0){u=2;const t=n.toString(),e=a.toString(),i=new _$bignumber_168(e).plus(new _$bignumber_168(t)),h=new _$bignumber_168(o);if("0"!==i.minus(h).toString())throw new Error("Token transaction inputs do not match outputs, cannot send transaction");s=_$dist_365.TokenType1.send(r,[new _$dist_365.BN(t),new _$dist_365.BN(e)])}else{const t=n.toString(),e=new _$bignumber_168(t),i=new _$bignumber_168(o);if("0"!==e.minus(i).toString())throw new Error("Token transaction inputs do not match outputs, cannot send transaction");s=_$dist_365.TokenType1.send(r,[new _$dist_365.BN(t)])}return{script:s,outputs:u}}catch(err){throw console.log("Error in generateSendOpReturn()"),err}}generateBurnOpReturn(t,e){try{const r=t[0].tokenId,i=t[0].decimals;let n=0;for(let e=0;en&&(e=n);let o=new _$bignumber_168(n-e).times(10**i);return o=o.absoluteValue(),o=(o=Math.floor(o)).toString(),_$dist_365.TokenType1.send(r,[new _$dist_365.BN(o)])}catch(err){throw console.log("Error in generateBurnOpReturn()"),err}}generateGenesisOpReturn(t){try{let e=new _$bignumber_168(t.initialQty).times(10**t.decimals);return e=e.absoluteValue(),e=(e=Math.floor(e)).toString(),t.documentHash||(t.documentHash=""),t.mintBatonVout||(t.mintBatonVout=null),_$dist_365.TokenType1.genesis(t.ticker,t.name,t.documentUrl,t.documentHash,t.decimals,t.mintBatonVout,new _$dist_365.BN(e))}catch(err){throw console.log("Error in generateGenesisOpReturn()"),err}}generateMintOpReturn(t,e,r=!1){try{if(!Array.isArray(t))throw new Error("tokenUtxos must be an array.");let i;for(let e=0;e0){a=2;const t=Math.floor(e).toString(),i=Math.floor(n).toString();o=_$dist_365.NFT1.Child.send(r,[new _$dist_365.BN(t),new _$dist_365.BN(i)])}else{const t=Math.floor(e).toString();o=_$dist_365.NFT1.Child.send(r,[new _$dist_365.BN(t)])}return{script:o,outputs:a}}catch(err){throw console.log("Error in generateNFTChildSendOpReturn()"),err}}generateNFTGroupSendOpReturn(t,e){try{const r=t[0].tokenId;let i=0;for(let e=0;e0){a=2;const t=Math.floor(e).toString(),i=Math.floor(n).toString();o=_$dist_365.NFT1.Group.send(r,[new _$dist_365.BN(t),new _$dist_365.BN(i)])}else{const t=Math.floor(e).toString();o=_$dist_365.NFT1.Group.send(r,[new _$dist_365.BN(t)])}return{script:o,outputs:a}}catch(err){throw console.log("Error in generateNFTGroupSendOpReturn()"),err}}},_$slp_27=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.Address=new _$address_24(t),this.ECPair=_$ecpair_25,this.TokenType1=new _$tokentype1_28(t),this.NFT1=new _$nft1_26(this.restURL),this.Utils=new _$utils_29(t)}},_$hasProperty_125=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e=7&&e<=10},cuid.fingerprint=_$fingerprintBrowser_263,_$cuid_262=cuid;var _$lodashThrottle_320={};(function(t){var e=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,a="object"==typeof t&&t&&t.Object===Object&&t,s="object"==typeof self&&self&&self.Object===Object&&self,u=a||s||Function("return this")(),h=Object.prototype.toString,f=Math.max,c=Math.min,l=function(){return u.Date.now()};function _(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function d(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==h.call(t)}(t))return NaN;if(_(t)){var a="function"==typeof t.valueOf?t.valueOf():t;t=_(a)?a+"":a}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(e,"");var s=i.test(t);return s||n.test(t)?o(t.slice(2),s?2:8):r.test(t)?NaN:+t}_$lodashThrottle_320=function(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return _(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),function(t,e,r){var i,n,o,a,s,u,h=0,p=!1,m=!1,b=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var r=i,o=n;return i=n=void 0,h=e,a=t.apply(o,r)}function v(t){var r=t-u;return void 0===u||r>=e||r<0||m&&t-h>=o}function y(){var t=l();if(v(t))return w(t);s=setTimeout(y,function(t){var r=e-(t-u);return m?c(r,o-(t-h)):r}(t))}function w(t){return s=void 0,b&&i?g(t):(i=n=void 0,a)}function M(){var t=l(),r=v(t);if(i=arguments,n=this,u=t,r){if(void 0===s)return function(t){return h=t,s=setTimeout(y,e),p?g(t):a}(u);if(m)return s=setTimeout(y,e),g(u)}return void 0===s&&(s=setTimeout(y,e)),a}return e=d(e)||0,_(r)&&(p=!!r.leading,o=(m="maxWait"in r)?f(d(r.maxWait)||0,e):o,b="trailing"in r?!!r.trailing:b),M.cancel=function(){void 0!==s&&clearTimeout(s),h=0,i=u=n=s=void 0},M.flush=function(){return void 0===s?a:w(l())},M}(t,e,{leading:i,maxWait:e,trailing:n})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$prettierBytes_98=function(t){if("number"!=typeof t||isNaN(t))throw new TypeError("Expected a number, got "+typeof t);var e=t<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(e&&(t=-t),t<1)return(e?"-":"")+t+" B";var i=Math.min(Math.floor(Math.log(t)/Math.log(1024)),r.length-1);t=Number(t/Math.pow(1024,i));var n=r[i];return t>=10||t%1==0?(e?"-":"")+t.toFixed(0)+" "+n:(e?"-":"")+t.toFixed(1)+" "+n},_$wildcard_394={};function WildcardMatcher(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}WildcardMatcher.prototype.match=function(t){var e,r,i=!0,n=this.parts,o=n.length;if("string"==typeof t||t instanceof String)if(this.hasWild||this.text==t){for(r=(t||"").split(this.separator),e=0;i&&e=2}return e?r(e.split(";")[0]):r},_$lib_110={};function ___extends_110(){return(___extends_110=Object.assign||function(t){for(var e=1;e18||18===i&&n>=18218};function __pad_124(t){return 2!==t.length?0+t:t}var _$getTimeStamp_124=function(){var t=new Date;return __pad_124(t.getHours().toString())+":"+__pad_124(t.getMinutes().toString())+":"+__pad_124(t.getSeconds().toString())},justErrorsLogger={debug:function(){},warn:function(){},error:function(){for(var t,e=arguments.length,r=new Array(e),i=0;i2;)M.push(arguments[a]);for(r&&null!=r.children&&(M.length||M.push(r.children),delete r.children);M.length;)if((n=M.pop())&&void 0!==n.pop)for(a=n.length;a--;)M.push(n[a]);else"boolean"==typeof n&&(n=null),(o="function"!=typeof e)&&(null==n?n="":"number"==typeof n?n=String(n):"string"!=typeof n&&(o=!1)),o&&i?s[s.length-1]+=n:s===S?s=[n]:s.push(n),i=o;var u=new t;return u.nodeName=e,u.children=s,u.attributes=null==r?void 0:r,u.key=null==r?void 0:r.key,void 0!==w.vnode&&w.vnode(u),u}function i(t,e){for(var r in e)t[r]=e[r];return t}function n(t){!t.__d&&(t.__d=!0)&&1==k.push(t)&&(w.debounceRendering||$)(o)}function o(){var t,e=k;for(k=[];t=e.pop();)t.__d&&g(t)}function a(t,e){return t.__n===e||t.nodeName.toLowerCase()===e.toLowerCase()}function s(t){var e=i({},t.attributes);e.children=t.children;var r=t.nodeName.defaultProps;if(void 0!==r)for(var n in r)void 0===e[n]&&(e[n]=r[n]);return e}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function h(t,r,i,n,o){if("className"===r&&(r="class"),"key"===r);else if("ref"===r)i&&i(null),n&&n(t);else if("class"!==r||o)if("style"===r){if(n&&"string"!=typeof n&&"string"!=typeof i||(t.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof i)for(var a in i)a in n||(t.style[a]="");for(var a in n)t.style[a]="number"==typeof n[a]&&!1===E.test(a)?n[a]+"px":n[a]}}else if("dangerouslySetInnerHTML"===r)n&&(t.innerHTML=n.__html||"");else if("o"==r[0]&&"n"==r[1]){var s=r!==(r=r.replace(/Capture$/,""));r=r.toLowerCase().substring(2),n?i||t.addEventListener(r,f,s):t.removeEventListener(r,f,s),(t.__l||(t.__l={}))[r]=n}else if("list"!==r&&"type"!==r&&!o&&r in t)!function(t,r,i){try{t[r]=i}catch(e){}}(t,r,null==n?"":n),null!=n&&!1!==n||t.removeAttribute(r);else{var u=o&&r!==(r=r.replace(/^xlink:?/,""));null==n||!1===n?u?t.removeAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase()):t.removeAttribute(r):"function"!=typeof n&&(u?t.setAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase(),n):t.setAttribute(r,n))}else t.className=n||""}function f(t){return this.__l[t.type](w.event&&w.event(t)||t)}function c(){for(var t;t=A.pop();)w.afterMount&&w.afterMount(t),t.componentDidMount&&t.componentDidMount()}function l(t,e,r,i,n,o){B++||(x=null!=n&&void 0!==n.ownerSVGElement,T=null!=t&&!("__preactattr_"in t));var f=function t(e,r,i,n,o){var f=e,c=x;if(null!=r&&"boolean"!=typeof r||(r=""),"string"==typeof r||"number"==typeof r)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=r&&(e.nodeValue=r):(f=document.createTextNode(r),e&&(e.parentNode&&e.parentNode.replaceChild(f,e),_(e,!0))),f.__preactattr_=!0,f;var l,d,m=r.nodeName;if("function"==typeof m)return function(t,e,r,i){for(var n=t&&t._component,o=n,a=t,u=n&&t._componentConstructor===e.nodeName,h=u,f=s(e);n&&!h&&(n=n.__u);)h=n.constructor===e.nodeName;return n&&h&&(!i||n._component)?(b(n,f,3,r,i),t=n.base):(o&&!u&&(v(o),t=a=null),n=p(e.nodeName,f,r),t&&!n.__b&&(n.__b=t,a=null),b(n,f,1,r,i),t=n.base,a&&t!==a&&(a._component=null,_(a,!1))),t}(e,r,i,n);if(x="svg"===m||"foreignObject"!==m&&x,m=String(m),(!e||!a(e,m))&&(l=m,(d=x?document.createElementNS("http://www.w3.org/2000/svg",l):document.createElement(l)).__n=l,f=d,e)){for(;e.firstChild;)f.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(f,e),_(e,!0)}var g=f.firstChild,y=f.__preactattr_,w=r.children;if(null==y){y=f.__preactattr_={};for(var M=f.attributes,S=M.length;S--;)y[M[S].name]=M[S].value}return!T&&w&&1===w.length&&"string"==typeof w[0]&&null!=g&&void 0!==g.splitText&&null==g.nextSibling?g.nodeValue!=w[0]&&(g.nodeValue=w[0]):(w&&w.length||null!=g)&&function(e,r,i,n,o){var s,h,f,c,l,d,p,m,b=e.childNodes,g=[],v={},y=0,w=0,M=b.length,S=0,$=r?r.length:0;if(0!==M)for(var E=0;E2?[].slice.call(arguments,2):t.children)},Component:y,render:function(t,e,r){return l(r,t,{},!1,e,!1)},rerender:o,options:w};_$preact_333.exports=P}(),_$preact_333=_$preact_333.exports;var _$isDOMElement_126=function(t){return t&&"object"==typeof t&&t.nodeType===Node.ELEMENT_NODE},_$findDOMElement_119=function(t,e){return void 0===e&&(e=document),"string"==typeof t?e.querySelector(t):_$isDOMElement_126(t)?t:void 0};function ___extends_106(){return(___extends_106=Object.assign||function(t){for(var e=1;e tag initializing Uppy is right before the closing tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.")},e.render=function(t){throw new Error("Extend the render method to add your plugin to a DOM element")},e.addTarget=function(t){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},e.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.install=function(){},e.uninstall=function(){this.unmount()},t}(),_$lib_107={};function ___extends_107(){return(___extends_107=Object.assign||function(t){for(var e=1;ea)throw new RestrictionError(""+this.i18n("youCanOnlyUploadX",{smart_count:a}));if(s&&!s.some((function(e){return e.indexOf("/")>-1?!!t.type&&_$mimeMatch_323(t.type.replace(/;.*?$/,""),e):!("."!==e[0]||!t.extension)&&t.extension.toLowerCase()===e.substr(1).toLowerCase()}))){var u=s.join(", ");throw new RestrictionError(this.i18n("youCanOnlyUploadFileTypes",{types:u}))}if(o&&null!=t.size){var h=0;if(h+=t.size,e.forEach((function(t){h+=t.size})),h>o)throw new RestrictionError(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:_$prettierBytes_98(o)}))}if(i&&null!=t.size&&t.size>i)throw new RestrictionError(this.i18n("exceedsSize2",{backwardsCompat:this.i18n("exceedsSize"),size:_$prettierBytes_98(i)}));if(n&&null!=t.size&&t.size5?this.log("Added batch of "+i.length+" files"):Object.keys(i).forEach((function(t){e.log("Added file: "+i[t].name+"\n id: "+i[t].id+"\n type: "+i[t].type)})),i.length>0&&this._startIfAutoProceed(),n.length>0){var s="Multiple errors occurred while adding files:\n";n.forEach((function(t){s+="\n * "+t.message})),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:n.length}),details:s},"error",this.opts.infoTimeout);var u=new Error(s);throw u.errors=n,u}},i.removeFiles=function(t,e){var r=this,i=this.getState(),n=i.files,o=i.currentUploads,a=___extends_107({},n),s=___extends_107({},o),u=Object.create(null);function h(t){return void 0===u[t]}t.forEach((function(t){n[t]&&(u[t]=n[t],delete a[t])}));var f=[];Object.keys(s).forEach((function(t){var e=o[t].fileIDs.filter(h);0!==e.length?s[t]=___extends_107({},o[t],{fileIDs:e}):f.push(t)})),f.forEach((function(t){delete s[t]}));var c={currentUploads:s,files:a};0===Object.keys(a).length&&(c.allowNewUpload=!0,c.error=null),this.setState(c),this._calculateTotalProgress();var l=Object.keys(u);l.forEach((function(t){r.emit("file-removed",u[t],e)})),l.length>5?this.log("Removed "+l.length+" files"):this.log("Removed files: "+l.join(", "))},i.removeFile=function(t,e){void 0===e&&(e=null),this.removeFiles([t],e)},i.pauseResume=function(t){if(this.getState().capabilities.resumableUploads&&!this.getFile(t).uploadComplete){var e=!this.getFile(t).isPaused;return this.setFileState(t,{isPaused:e}),this.emit("upload-pause",t,e),e}},i.pauseAll=function(){var t=___extends_107({},this.getState().files);Object.keys(t).filter((function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted})).forEach((function(e){var r=___extends_107({},t[e],{isPaused:!0});t[e]=r})),this.setState({files:t}),this.emit("pause-all")},i.resumeAll=function(){var t=___extends_107({},this.getState().files);Object.keys(t).filter((function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted})).forEach((function(e){var r=___extends_107({},t[e],{isPaused:!1,error:null});t[e]=r})),this.setState({files:t}),this.emit("resume-all")},i.retryAll=function(){var t=___extends_107({},this.getState().files),e=Object.keys(t).filter((function(e){return t[e].error}));if(e.forEach((function(e){var r=___extends_107({},t[e],{isPaused:!1,error:null});t[e]=r})),this.setState({files:t,error:null}),this.emit("retry-all",e),0===e.length)return Promise.resolve({successful:[],failed:[]});var r=this._createUpload(e,{forceAllowNewUpload:!0});return this._runUpload(r)},i.cancelAll=function(){this.emit("cancel-all");var t=this.getState().files,e=Object.keys(t);e.length&&this.removeFiles(e,"cancel-all"),this.setState({totalProgress:0,error:null})},i.retryUpload=function(t){this.setFileState(t,{error:null,isPaused:!1}),this.emit("upload-retry",t);var e=this._createUpload([t],{forceAllowNewUpload:!0});return this._runUpload(e)},i.reset=function(){this.cancelAll()},i._calculateProgress=function(t,e){if(this.getFile(t.id)){var r=isFinite(e.bytesTotal)&&e.bytesTotal>0;this.setFileState(t.id,{progress:___extends_107({},this.getFile(t.id).progress,{bytesUploaded:e.bytesUploaded,bytesTotal:e.bytesTotal,percentage:r?Math.round(e.bytesUploaded/e.bytesTotal*100):0})}),this._calculateTotalProgress()}else this.log("Not setting progress for a file that has been removed: "+t.id)},i._calculateTotalProgress=function(){var t=this.getFiles().filter((function(t){return t.progress.uploadStarted||t.progress.preprocess||t.progress.postprocess}));if(0===t.length)return this.emit("progress",0),void this.setState({totalProgress:0});var e=t.filter((function(t){return null!=t.progress.bytesTotal})),r=t.filter((function(t){return null==t.progress.bytesTotal}));if(0!==e.length){var i=e.reduce((function(t,e){return t+e.progress.bytesTotal}),0),n=i/e.length;i+=n*r.length;var o=0;e.forEach((function(t){o+=t.progress.bytesUploaded})),r.forEach((function(t){o+=n*(t.progress.percentage||0)/100}));var a=0===i?0:Math.round(o/i*100);a>100&&(a=100),this.setState({totalProgress:a}),this.emit("progress",a)}else{var s=100*t.length,u=r.reduce((function(t,e){return t+e.progress.percentage}),0),h=Math.round(u/s*100);this.setState({totalProgress:h})}},i._addListeners=function(){var t=this;this.on("error",(function(e){var r="Unknown error";e.message&&(r=e.message),e.details&&(r+=" "+e.details),t.setState({error:r})})),this.on("upload-error",(function(e,r,i){var n="Unknown error";if(r.message&&(n=r.message),r.details&&(n+=" "+r.details),t.setFileState(e.id,{error:n,response:i}),t.setState({error:r.message}),"object"==typeof r&&r.message){var o=new Error(r.message);o.details=r.message,r.details&&(o.details+=" "+r.details),o.message=t.i18n("failedToUpload",{file:e.name}),t._showOrLogErrorAndThrow(o,{throwErr:!1})}else t._showOrLogErrorAndThrow(r,{throwErr:!1})})),this.on("upload",(function(){t.setState({error:null})})),this.on("upload-started",(function(e,r){t.getFile(e.id)?t.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("upload-progress",this._calculateProgress),this.on("upload-success",(function(e,r){if(t.getFile(e.id)){var i=t.getFile(e.id).progress;t.setFileState(e.id,{progress:___extends_107({},i,{postprocess:t.postProcessors.length>0?{mode:"indeterminate"}:null,uploadComplete:!0,percentage:100,bytesUploaded:i.bytesTotal}),response:r,uploadURL:r.uploadURL,isPaused:!1}),t._calculateTotalProgress()}else t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("preprocess-progress",(function(e,r){t.getFile(e.id)?t.setFileState(e.id,{progress:___extends_107({},t.getFile(e.id).progress,{preprocess:r})}):t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("preprocess-complete",(function(e){if(t.getFile(e.id)){var r=___extends_107({},t.getState().files);r[e.id]=___extends_107({},r[e.id],{progress:___extends_107({},r[e.id].progress)}),delete r[e.id].progress.preprocess,t.setState({files:r})}else t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("postprocess-progress",(function(e,r){t.getFile(e.id)?t.setFileState(e.id,{progress:___extends_107({},t.getState().files[e.id].progress,{postprocess:r})}):t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("postprocess-complete",(function(e){if(t.getFile(e.id)){var r=___extends_107({},t.getState().files);r[e.id]=___extends_107({},r[e.id],{progress:___extends_107({},r[e.id].progress)}),delete r[e.id].progress.postprocess,t.setState({files:r})}else t.log("Not setting progress for a file that has been removed: "+e.id)})),this.on("restored",(function(){t._calculateTotalProgress()})),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",(function(){return t.updateOnlineStatus()})),window.addEventListener("offline",(function(){return t.updateOnlineStatus()})),setTimeout((function(){return t.updateOnlineStatus()}),3e3))},i.updateOnlineStatus=function(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)},i.getID=function(){return this.opts.id},i.use=function(t,e){if("function"!=typeof t)throw new TypeError("Expected a plugin class, but got "+(null===t?"null":typeof t)+". Please verify that the plugin was imported and spelled correctly.");var r=new t(this,e),i=r.id;if(this.plugins[r.type]=this.plugins[r.type]||[],!i)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");var n=this.getPlugin(i);if(n){var o="Already found a plugin named '"+n.id+"'. Tried to use: '"+i+"'.\nUppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.";throw new Error(o)}return t.VERSION&&this.log("Using "+i+" v"+t.VERSION),this.plugins[r.type].push(r),r.install(),this},i.getPlugin=function(t){var e=null;return this.iteratePlugins((function(r){if(r.id===t)return e=r,!1})),e},i.iteratePlugins=function(t){var e=this;Object.keys(this.plugins).forEach((function(r){e.plugins[r].forEach(t)}))},i.removePlugin=function(t){this.log("Removing plugin "+t.id),this.emit("plugin-remove",t),t.uninstall&&t.uninstall();var e=this.plugins[t.type].slice(),r=e.indexOf(t);-1!==r&&(e.splice(r,1),this.plugins[t.type]=e);var i=this.getState();delete i.plugins[t.id],this.setState(i)},i.close=function(){var t=this;this.log("Closing Uppy instance "+this.opts.id+": removing all files and uninstalling plugins"),this.reset(),this._storeUnsubscribe(),this.iteratePlugins((function(e){t.removePlugin(e)}))},i.info=function(t,e,r){void 0===e&&(e="info"),void 0===r&&(r=3e3);var i="object"==typeof t;this.setState({info:{isHidden:!1,type:e,message:i?t.message:t,details:i?t.details:null}}),this.emit("info-visible"),clearTimeout(this.infoTimeoutID),this.infoTimeoutID=0!==r?setTimeout(this.hideInfo,r):void 0},i.hideInfo=function(){var t=___extends_107({},this.getState().info,{isHidden:!0});this.setState({info:t}),this.emit("info-hidden")},i.log=function(t,e){var r=this.opts.logger;switch(e){case"error":r.error(t);break;case"warning":r.warn(t);break;default:r.debug(t)}},i.run=function(){return this.log("Calling run() is no longer necessary.","warning"),this},i.restore=function(t){return this.log('Core: attempting to restore upload "'+t+'"'),this.getState().currentUploads[t]?this._runUpload(t):(this._removeUpload(t),Promise.reject(new Error("Nonexistent upload")))},i._createUpload=function(t,e){var r;void 0===e&&(e={});var i=e.forceAllowNewUpload,n=void 0!==i&&i,o=this.getState(),a=o.allowNewUpload,s=o.currentUploads;if(!a&&!n)throw new Error("Cannot create a new upload: already uploading.");var u=_$cuid_262();return this.emit("upload",{id:u,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploads,currentUploads:___extends_107({},s,(r={},r[u]={fileIDs:t,step:0,result:{}},r))}),u},i._getUpload=function(t){return this.getState().currentUploads[t]},i.addResultData=function(t,e){var r;if(this._getUpload(t)){var i=this.getState().currentUploads,n=___extends_107({},i[t],{result:___extends_107({},i[t].result,e)});this.setState({currentUploads:___extends_107({},i,(r={},r[t]=n,r))})}else this.log("Not setting result for an upload that has been removed: "+t)},i._removeUpload=function(t){var e=___extends_107({},this.getState().currentUploads);delete e[t],this.setState({currentUploads:e})},i._runUpload=function(t){var e=this,r=this.getState().currentUploads[t].step,i=[].concat(this.preProcessors,this.uploaders,this.postProcessors),n=Promise.resolve();return i.forEach((function(i,o){o>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return o(240|e>>>18&7)+o(128|e>>>12&63)+o(128|e>>>6&63)+o(128|63&e)},s=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(t){return t.replace(s,a)},h=function(t){var e=[0,2,1][t.length%3],r=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[i.charAt(r>>>18),i.charAt(r>>>12&63),e>=2?"=":i.charAt(r>>>6&63),e>=1?"=":i.charAt(63&r)].join("")},f=t.btoa&&"function"==typeof t.btoa?function(e){return t.btoa(e)}:function(t){if(t.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return t.replace(/[\s\S]{1,3}/g,h)},c=function(t){return f(u(String(t)))},l=function(t){return t.replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"})).replace(/=/g,"")},_=function(t,e){return e?l(c(t)):c(t)};t.Uint8Array&&(e=function(t,e){for(var r="",n=0,o=t.length;n>>18)+i.charAt(h>>>12&63)+(void 0!==s?i.charAt(h>>>6&63):"=")+(void 0!==u?i.charAt(63&h):"=")}return e?l(r):r});var d,p=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,m=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return o(55296+(e>>>10))+o(56320+(1023&e));case 3:return o((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return o((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},b=function(t){return t.replace(p,m)},g=function(t){var e=t.length,r=e%4,i=(e>0?n[t.charAt(0)]<<18:0)|(e>1?n[t.charAt(1)]<<12:0)|(e>2?n[t.charAt(2)]<<6:0)|(e>3?n[t.charAt(3)]:0),a=[o(i>>>16),o(i>>>8&255),o(255&i)];return a.length-=[0,0,2,1][r],a.join("")},v=t.atob&&"function"==typeof t.atob?function(e){return t.atob(e)}:function(t){return t.replace(/\S{1,4}/g,g)},y=function(t){return v(String(t).replace(/[^A-Za-z0-9\+\/]/g,""))},w=function(t){return String(t).replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},M=function(t){return function(t){return b(v(t))}(w(t))};if(t.Uint8Array&&(d=function(t){return Uint8Array.from(y(w(t)),(function(t){return t.charCodeAt(0)}))}),t.Base64={VERSION:"2.6.4",atob:y,btoa:f,fromBase64:M,toBase64:_,utob:u,encode:_,encodeURI:function(t){return _(t,!0)},btou:b,decode:M,noConflict:function(){var e=t.Base64;return t.Base64=r,e},fromUint8Array:e,toUint8Array:d},"function"==typeof Object.defineProperty){var S=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}};t.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",S((function(){return M(this)}))),Object.defineProperty(String.prototype,"toBase64",S((function(t){return _(this,t)}))),Object.defineProperty(String.prototype,"toBase64URI",S((function(){return _(this,!0)})))}}return t.Meteor&&(Base64=t.Base64),_$base64_318.exports?_$base64_318.exports.Base64=t.Base64:"function"==typeof define&&define.amd&&define([],(function(){return t.Base64})),{Base64:t.Base64}}))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$base64_318=_$base64_318.exports;var _$requiresPort_343=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},_$querystringify_340={},undef,__has_340=Object.prototype.hasOwnProperty;function decode(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return null}}function __encode_340(t){try{return encodeURIComponent(t)}catch(e){return null}}_$querystringify_340.stringify=function(t,e){e=e||"";var r,i,n=[];for(i in"string"!=typeof e&&(e="?"),t)if(__has_340.call(t,i)){if((r=t[i])||null!==r&&r!==undef&&!isNaN(r)||(r=""),i=__encode_340(i),r=__encode_340(r),null===i||null===r)continue;n.push(i+"="+r)}return n.length?e+n.join("&"):""},_$querystringify_340.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,i={};e=r.exec(t);){var n=decode(e[1]),o=decode(e[2]);null===n||null===o||n in i||(i[n]=o)}return i};var _$urlParse_390={};(function(t){"use strict";var e=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,r=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,i=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function n(t){return(t||"").toString().replace(i,"")}var o=[["#","hash"],["?","query"],function(t){return t.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],a={hash:1,query:1};function s(r){var i,n=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(r=r||n);if("blob:"===r.protocol)o=new h(unescape(r.pathname),{});else if("string"===s)for(i in o=new h(r,{}),a)delete o[i];else if("object"===s){for(i in r)i in a||(o[i]=r[i]);void 0===o.slashes&&(o.slashes=e.test(r.href))}return o}function u(t){t=n(t);var e=r.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!(e[2]&&e[2].length>=2),rest:e[2]&&1===e[2].length?"/"+e[3]:e[3]}}function h(t,e,r){if(t=n(t),!(this instanceof h))return new h(t,e,r);var i,a,f,c,l,_,d=o.slice(),p=typeof e,m=this,b=0;for("object"!==p&&"string"!==p&&(r=e,e=null),r&&"function"!=typeof r&&(r=_$querystringify_340.parse),e=s(e),i=!(a=u(t||"")).protocol&&!a.slashes,m.slashes=a.slashes||i&&e.slashes,m.protocol=a.protocol||e.protocol||"",t=a.rest,a.slashes||(d[3]=[/(.*)/,"pathname"]);b1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(i=e.call(this,t)).originalRequest=o,i.originalResponse=a,i.causingError=n,null!=n&&(t+=", caused by ".concat(n.toString())),null!=o){var s=o.getHeader("X-Request-ID")||"n/a",u=o.getMethod(),h=o.getURL(),f=a?a.getStatus():"n/a",c=a?a.getBody()||"":"n/a";t+=", originated from request (method: ".concat(u,", url: ").concat(h,", response code: ").concat(f,", response text: ").concat(c,", request id: ").concat(s,")")}return i.message=t,i}return r}();_$error_381.default=___default_381;var _$logger_382={};Object.defineProperty(_$logger_382,"__esModule",{value:!0}),_$logger_382.enableDebugLog=function(){isEnabled=!0},_$logger_382.log=function(t){isEnabled&&console.log(t)};var isEnabled=!1,_$uuid_385={};Object.defineProperty(_$uuid_385,"__esModule",{value:!0}),_$uuid_385.default=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))};var _$upload_384={};Object.defineProperty(_$upload_384,"__esModule",{value:!0}),_$upload_384.default=void 0;var _urlParse=_interopRequireDefault(_$urlParse_390),_error=_interopRequireDefault(_$error_381),_uuid=_interopRequireDefault(_$uuid_385);function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function __ownKeys_384(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if("function"==typeof r||"function"==typeof i)throw new Error("tus: the terminate function does not accept a callback since v2 anymore; please use the returned Promise instead");var n=openRequest("DELETE",e,r);return sendRequest(n,null,r).then((function(t){if(204!==t.getStatus())throw new _error.default("tus: unexpected response while terminating upload",null,n,t)})).catch((function(i){if(i instanceof _error.default||(i=new _error.default("tus: failed to terminate upload",i,n,null)),!shouldRetry(i,0,r))throw i;var o=r.retryDelays[0],a=r.retryDelays.slice(1),s=_objectSpread({},r,{retryDelays:a});return new Promise((function(t){return setTimeout(t,o)})).then((function(){return t.terminate(e,s)}))}))}}],(r=[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then((function(e){return t._urlStorage.findUploadsByFingerprint(e)}))}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,e=this.file;if(e)if(this.options.endpoint||this.options.uploadUrl){var r=this.options.retryDelays;null==r||"[object Array]"===Object.prototype.toString.call(r)?(this.options.parallelUploads>1&&["uploadUrl","uploadSize","uploadLengthDeferred"].forEach((function(e){t.options[e]&&t._emitError(new Error("tus: cannot use the ".concat(e," option when parallelUploads is enabled")))})),this.options.fingerprint(e,this.options).then((function(r){return null==r?(0,_$logger_382.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,_$logger_382.log)("Calculated fingerprint: ".concat(r)),t._fingerprint=r,t._source?t._source:t.options.fileReader.openFile(e,t.options.chunkSize)})).then((function(e){t._source=e,t.options.parallelUploads>1||null!=t._parallelUploadUrls?t._startParallelUpload():t._startSingleUpload()})).catch((function(e){t._emitError(e)}))):this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var e=this,r=this._size=this._source.size,i=0;this._parallelUploads=[];var n=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,o=function(t,e,r){for(var i=Math.floor(t/e),n=[],o=0;othis._offsetBeforeRetry&&(this._retryAttempt=0),shouldRetry(t,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){e.start()}),r))}if("function"!=typeof this.options.onError)throw t;this.options.onError(t)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,e){"function"==typeof this.options.onProgress&&this.options.onProgress(t,e)}},{key:"_emitChunkComplete",value:function(t,e,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(t,e,r)}},{key:"_createUpload",value:function(){var t=this;if(this.options.endpoint){var e=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?e.setHeader("Upload-Defer-Length",1):e.setHeader("Upload-Length",this._size);var r,i=encodeMetadata(this.options.metadata);""!==i&&e.setHeader("Upload-Metadata",i),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(e)):r=this._sendRequest(e,null),r.then((function(r){if(inStatusCategory(r.getStatus(),200)){var i=r.getHeader("Location");if(null!=i){if(t.url=resolveUrl(t.options.endpoint,i),(0,_$logger_382.log)("Created upload at ".concat(t.url)),"function"==typeof t.options._onUploadUrlAvailable&&t.options._onUploadUrlAvailable(),0===t._size)return t._emitSuccess(),void t._source.close();t._saveUploadInUrlStorage(),t.options.uploadDataDuringCreation?t._handleUploadResponse(e,r):(t._offset=0,t._performUpload())}else t._emitHttpError(e,r,"tus: invalid or missing Location header")}else t._emitHttpError(e,r,"tus: unexpected response while creating upload")})).catch((function(r){t._emitHttpError(e,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var t=this,e=this._openRequest("HEAD",this.url);this._sendRequest(e,null).then((function(r){var i=r.getStatus();if(!inStatusCategory(i,200))return inStatusCategory(i,400)&&t._removeFromUrlStorage(),423===i?void t._emitHttpError(e,r,"tus: upload is currently locked; retry later"):t.options.endpoint?(t.url=null,void t._createUpload()):void t._emitHttpError(e,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)");var n=parseInt(r.getHeader("Upload-Offset"),10);if(isNaN(n))t._emitHttpError(e,r,"tus: invalid or missing offset value");else{var o=parseInt(r.getHeader("Upload-Length"),10);if(!isNaN(o)||t.options.uploadLengthDeferred){if("function"==typeof t.options._onUploadUrlAvailable&&t.options._onUploadUrlAvailable(),n===o)return t._emitProgress(o,o),void t._emitSuccess();t._offset=n,t._performUpload()}else t._emitHttpError(e,r,"tus: invalid or missing length value")}})).catch((function(r){t._emitHttpError(e,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var t,e=this;this._aborted||(this.options.overridePatchMethod?(t=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):t=this._openRequest("PATCH",this.url),t.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(t).then((function(r){inStatusCategory(r.getStatus(),200)?e._handleUploadResponse(t,r):e._emitHttpError(t,r,"tus: unexpected response while uploading chunk")})).catch((function(r){e._aborted||e._emitHttpError(t,null,"tus: failed to upload chunk at offset "+e._offset,r)})))}},{key:"_addChunkToRequest",value:function(t){var e=this,r=this._offset,i=this._offset+this.options.chunkSize;return t.setProgressHandler((function(t){e._emitProgress(r+t,e._size)})),t.setHeader("Content-Type","application/offset+octet-stream"),(i===1/0||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(r,i).then((function(r){var i=r.value,n=r.done;return e.options.uploadLengthDeferred&&n&&(e._size=e._offset+(i&&i.size?i.size:0),t.setHeader("Upload-Length",e._size)),null===i?e._sendRequest(t):(e._emitProgress(e._offset,e._size),e._sendRequest(t,i))}))}},{key:"_handleUploadResponse",value:function(t,e){var r=parseInt(e.getHeader("Upload-Offset"),10);if(isNaN(r))this._emitHttpError(t,e,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r==this._size)return this._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(t,e){var r=openRequest(t,e,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(e){t._emitError(e)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(this.options.storeFingerprintForResuming&&this._fingerprint){var e={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};this._parallelUploads?e.parallelUploadUrls=this._parallelUploadUrls:e.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,e).then((function(e){return t._urlStorageKey=e})).catch((function(e){t._emitError(e)}))}}},{key:"_sendRequest",value:function(t){return sendRequest(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,this.options)}}])&&___defineProperties_384(e.prototype,r),i&&___defineProperties_384(e,i),t}();function encodeMetadata(t){var e=[];for(var r in t)e.push(r+" "+_$base64_318.Base64.encode(t[r]));return e.join(",")}function inStatusCategory(t,e){return t>=e&&t=r.retryDelays.length||null==t.originalRequest)return!1;if(r&&"function"==typeof r.onShouldRetry)return r.onShouldRetry(t,e,r);var i,n=t.originalResponse?t.originalResponse.getStatus():0;return(!inStatusCategory(n,400)||409===n||423===n)&&(i=!0,"undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(i=!1),i)}function resolveUrl(t,e){return new _urlParse.default(e,t).toString()}BaseUpload.defaultOptions=defaultOptions;var ___default_384=BaseUpload;_$upload_384.default=___default_384;var _$noopUrlStorage_383={};function ___defineProperties_383(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,i){t._xhr.onload=function(){r(new Response(t._xhr))},t._xhr.onerror=function(t){i(t)},t._xhr.send(e)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),t}(),Response=function(){function t(e){_classCallCheck(this,t),this._xhr=e}return _createClass(t,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),t}(),_$isReactNative_377={};Object.defineProperty(_$isReactNative_377,"__esModule",{value:!0}),_$isReactNative_377.default=void 0;var ___default_377=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};_$isReactNative_377.default=___default_377;var _$uriToBlob_379={};Object.defineProperty(_$uriToBlob_379,"__esModule",{value:!0}),_$uriToBlob_379.default=function(t){return new Promise((function(e,r){var i=new XMLHttpRequest;i.responseType="blob",i.onload=function(){var t=i.response;e(t)},i.onerror=function(t){r(t)},i.open("GET",t),i.send()}))};var _$isCordova_376={};Object.defineProperty(_$isCordova_376,"__esModule",{value:!0}),_$isCordova_376.default=void 0;var ___default_376=function(){return"undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)};_$isCordova_376.default=___default_376;var _$readAsByteArray_378={};Object.defineProperty(_$readAsByteArray_378,"__esModule",{value:!0}),_$readAsByteArray_378.default=function(t){return new Promise((function(e,r){var i=new FileReader;i.onload=function(){var t=new Uint8Array(i.result);e({value:t})},i.onerror=function(t){r(t)},i.readAsArrayBuffer(t)}))};var _$fileReader_372={};Object.defineProperty(_$fileReader_372,"__esModule",{value:!0}),_$fileReader_372.default=void 0;var _isReactNative=___interopRequireDefault_372(_$isReactNative_377),_uriToBlob=___interopRequireDefault_372(_$uriToBlob_379),_isCordova=___interopRequireDefault_372(_$isCordova_376),_readAsByteArray=___interopRequireDefault_372(_$readAsByteArray_378);function ___interopRequireDefault_372(t){return t&&t.__esModule?t:{default:t}}function ___classCallCheck_372(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ___defineProperties_372(t,e){for(var r=0;rthis._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var r=0===__len_372(this._buffer);return this._done&&r?null:this._buffer.slice(0,e-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),t}();function __len_372(t){return void 0===t?0:void 0!==t.size?t.size:t.length}var __FileReader_372=function(){function t(){___classCallCheck_372(this,t)}return ___createClass_372(t,[{key:"openFile",value:function(t,e){return(0,_isReactNative.default)()&&t&&void 0!==t.uri?(0,_uriToBlob.default)(t.uri).then((function(t){return new FileSource(t)})).catch((function(t){throw new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. "+t)})):"function"==typeof t.slice&&void 0!==t.size?Promise.resolve(new FileSource(t)):"function"==typeof t.read?(e=+e,isFinite(e)?Promise.resolve(new StreamSource(t,e)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment"))}}]),t}();_$fileReader_372.default=__FileReader_372;var _$fingerprint_373={};Object.defineProperty(_$fingerprint_373,"__esModule",{value:!0}),_$fingerprint_373.default=function(t,e){return(0,___isReactNative_373.default)()?Promise.resolve(function(t,e){var r=t.exif?function(t){var e=0;if(0===t.length)return e;for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=___objectSpread_375({},__defaultOptions_375,{},e),i.call(this,t,e)}return e=n,r=[{key:"terminate",value:function(t,e,r){return e=___objectSpread_375({},__defaultOptions_375,{},e),_upload.default.terminate(t,e,r)}}],null&&___defineProperties_375(e.prototype,null),r&&___defineProperties_375(e,r),n}();_$browser_375.Upload=Upload;var _window=window,__XMLHttpRequest_375=_window.XMLHttpRequest,__Blob_375=_window.Blob,isSupported=__XMLHttpRequest_375&&__Blob_375&&"function"==typeof __Blob_375.prototype.slice;function ___wrapNativeSuper_99(t){var e="function"==typeof Map?new Map:void 0;return(___wrapNativeSuper_99=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return ___construct_99(t,arguments,___getPrototypeOf_99(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),___setPrototypeOf_99(i,t)})(t)}function ___construct_99(t,r,i){return(___construct_99=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&___setPrototypeOf_99(n,r.prototype),n}).apply(null,arguments)}function ___setPrototypeOf_99(t,e){return(___setPrototypeOf_99=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ___getPrototypeOf_99(t){return(___getPrototypeOf_99=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var AuthError=function(t){var e,r;function i(){var e;return(e=t.call(this,"Authorization required")||this).name="AuthError",e.isAuthError=!0,e}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(___wrapNativeSuper_99(Error)),_$AuthError_99=AuthError;function ___wrapNativeSuper_114(t){var e="function"==typeof Map?new Map:void 0;return(___wrapNativeSuper_114=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return ___construct_114(t,arguments,___getPrototypeOf_114(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),___setPrototypeOf_114(i,t)})(t)}function ___construct_114(t,r,i){return(___construct_114=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&___setPrototypeOf_114(n,r.prototype),n}).apply(null,arguments)}function ___setPrototypeOf_114(t,e){return(___setPrototypeOf_114=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ___getPrototypeOf_114(t){return(___getPrototypeOf_114=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var NetworkError=function(t){var e,r;function i(e,r){var i;return void 0===r&&(r=null),(i=t.call(this,"This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.\n\nSource error: ["+e+"]")||this).isNetworkError=!0,i.request=r,i}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(___wrapNativeSuper_114(Error)),_$NetworkError_114=NetworkError,_$fetchWithNetworkError_118=function(){return fetch.apply(void 0,arguments).catch((function(t){throw"AbortError"===t.name?t:new _$NetworkError_114(t)}))},_class,_temp;function ___extends_101(){return(___extends_101=Object.assign||function(t){for(var e=1;e300){var e="Failed request with status: "+t.status+". "+t.statusText;return t.json().then((function(t){throw e=t.message?e+" message: "+t.message:e,e=t.requestId?e+" request-Id: "+t.requestId:e,new Error(e)})).catch((function(){throw new Error(e)}))}return t.json()},i.preflight=function(t){var e=this;return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(this._getUrl(t),{method:"OPTIONS"}).then((function(t){return t.headers.has("access-control-allow-headers")&&(e.allowedHeaders=t.headers.get("access-control-allow-headers").split(",").map((function(t){return t.trim().toLowerCase()}))),e.preflightDone=!0,e.allowedHeaders.slice()})).catch((function(t){return e.uppy.log("[CompanionClient] unable to make preflight request "+t,"warning"),e.preflightDone=!0,e.allowedHeaders.slice()}))},i.preflightAndHeaders=function(t){var e=this;return Promise.all([this.preflight(t),this.headers()]).then((function(t){var r=t[0],i=t[1];return Object.keys(i).forEach((function(t){-1===r.indexOf(t.toLowerCase())&&(e.uppy.log("[CompanionClient] excluding unallowed header "+t),delete i[t])})),i}))},i.get=function(t,e){var r=this;return this.preflightAndHeaders(t).then((function(e){return _$fetchWithNetworkError_118(r._getUrl(t),{method:"get",headers:e,credentials:r.opts.companionCookiesRule||"same-origin"})})).then(this._getPostResponseFunc(e)).then((function(t){return r._json(t)})).catch((function(e){return e=e.isAuthError?e:new Error("Could not get "+r._getUrl(t)+". "+e),Promise.reject(e)}))},i.post=function(t,e,r){var i=this;return this.preflightAndHeaders(t).then((function(r){return _$fetchWithNetworkError_118(i._getUrl(t),{method:"post",headers:r,credentials:i.opts.companionCookiesRule||"same-origin",body:JSON.stringify(e)})})).then(this._getPostResponseFunc(r)).then((function(t){return i._json(t)})).catch((function(e){return e=e.isAuthError?e:new Error("Could not post "+i._getUrl(t)+". "+e),Promise.reject(e)}))},i.delete=function(t,e,r){var i=this;return this.preflightAndHeaders(t).then((function(r){return _$fetchWithNetworkError_118(i.hostname+"/"+t,{method:"delete",headers:r,credentials:i.opts.companionCookiesRule||"same-origin",body:e?JSON.stringify(e):null})})).then(this._getPostResponseFunc(r)).then((function(t){return i._json(t)})).catch((function(e){return e=e.isAuthError?e:new Error("Could not delete "+i._getUrl(t)+". "+e),Promise.reject(e)}))},e=t,(r=[{key:"hostname",get:function(){var t=this.uppy.getState().companion,e=this.opts.companionUrl;return(t&&t[e]?t[e]:e).replace(/\/$/,"")}},{key:"defaultHeaders",get:function(){return{Accept:"application/json","Content-Type":"application/json","Uppy-Versions":"@uppy/companion-client="+t.VERSION}}}])&&___defineProperties_101(e.prototype,r),t}(),_class.VERSION="1.8.2",_temp),__has_334=Object.prototype.hasOwnProperty,_$queryStringify_334=function t(e,r){var i=[];for(var n in e)if(__has_334.call(e,n)){var o,a=e[n],s=encodeURIComponent(n);o="object"==typeof a?t(a,r?r+"["+s+"]":s):(r?r+"["+s+"]":s)+"="+encodeURIComponent(a),i.push(o)}return i.join("&")},_$tokenStorage_105={};function ___extends_100(){return(___extends_100=Object.assign||function(t){for(var e=1;e0&&t.isOpen;){var r=t._queued[0];t.send(r.action,r.payload),t._queued=t._queued.slice(1)}},this.socket.onclose=function(e){t.isOpen=!1},this.socket.onmessage=this._handleMessage},e.close=function(){this.socket&&this.socket.close()},e.send=function(t,e){this.isOpen?this.socket.send(JSON.stringify({action:t,payload:e})):this._queued.push({action:t,payload:e})},e.on=function(t,e){this.emitter.on(t,e)},e.emit=function(t,e){this.emitter.emit(t,e)},e.once=function(t,e){this.emitter.once(t,e)},e._handleMessage=function(t){try{var e=JSON.parse(t.data);this.emit(e.action,e.payload)}catch(err){console.log(err)}},t}(),_$lib_104={RequestClient:_$RequestClient_101,Provider:_$Provider_100,Socket:_$Socket_103},_$emitSocketProgress_117=_$lodashThrottle_320((function(t,e,r){var i=e.progress,n=e.bytesUploaded,o=e.bytesTotal;i&&(t.uppy.log("Upload progress: "+i),t.uppy.emit("upload-progress",r,{uploader:t,bytesUploaded:n,bytesTotal:o}))}),300,{leading:!0,trailing:!0}),_$getSocketHost_123=function(t){var e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(t)[1];return(/^http:\/\//i.test(t)?"ws":"wss")+"://"+e},_$settle_129=function(t){var e=[],r=[];function i(t){e.push(t)}function n(t){r.push(t)}return Promise.all(t.map((function(t){return t.then(i,n)}))).then((function(){return{successful:e,failed:r}}))},_$EventTracker_113=function(){function t(t){this._events=[],this._emitter=t}var e=t.prototype;return e.on=function(t,e){return this._events.push([t,e]),this._emitter.on(t,e)},e.remove=function(){var t=this;this._events.forEach((function(e){var r=e[0],i=e[1];t._emitter.off(r,i)}))},t}(),_$isNetworkError_127=function(t){return!!t&&(0!==t.readyState&&4!==t.readyState||0===t.status)},_$RateLimitedQueue_115=function(){function t(t){this.limit="number"!=typeof t||0===t?1/0:t,this.activeRequests=0,this.queuedHandlers=[]}var e=t.prototype;return e._call=function(t){var e=this;this.activeRequests+=1;var r,i=!1;try{r=t()}catch(err){throw this.activeRequests-=1,err}return{abort:function(){i||(i=!0,e.activeRequests-=1,r(),e._queueNext())},done:function(){i||(i=!0,e.activeRequests-=1,e._queueNext())}}},e._queueNext=function(){var t=this;Promise.resolve().then((function(){t._next()}))},e._next=function(){if(!(this.activeRequests>=this.limit)&&0!==this.queuedHandlers.length){var t=this.queuedHandlers.shift(),e=this._call(t.fn);t.abort=e.abort,t.done=e.done}},e._queue=function(t,e){var r=this;void 0===e&&(e={});var i={fn:t,priority:e.priority||0,abort:function(){r._dequeue(i)},done:function(){throw new Error("Cannot mark a queued request as done: this indicates a bug")}},n=function(t,e){for(var r=0;rn.priority)return r;var n;return-1}(this.queuedHandlers);return-1===n?this.queuedHandlers.push(i):this.queuedHandlers.splice(n,0,i),i},e._dequeue=function(t){var e=this.queuedHandlers.indexOf(t);-1!==e&&this.queuedHandlers.splice(e,1)},e.run=function(t,e){return this.activeRequestst.height>0),"DESCENDING"===e?t.sort((t,e)=>e.height-t.height):t.sort((t,e)=>t.height-e.height)}catch(err){throw console.log("Error in util.js/sortConfTxs()"),err}}async sortAllTxs(t,e="DESCENDING"){try{const r=await this.blockchain.getBlockCount()+1,i=t.map(t=>(t.height<=0&&(t.height=r),t));return this.sortConfTxs(i,e)}catch(err){throw console.log("Error in util.js/sort0ConfTxs"),err}}},_$utxo_32=class{constructor(t){this.electrumx=new _$electrumx_12(t),this.slp=new _$slp_27(t)}async get(t,e=!1){try{if("string"==typeof t&&(t=[t]),t.length>20)throw new Error("Too many elements, 20 max.");const r=t.map(t=>this.slp.Address.toCashAddress(t)),i=await this.electrumx.utxo(r);let n;n=e?await this.slp.Utils.hydrateUtxosWL(i.utxos):await this.slp.Utils.hydrateUtxos(i.utxos);const o=[];for(let t=0;t!1===t.isValid),r.nullUtxos=e.utxos.filter(t=>null===t.isValid),r.slpUtxos={type1:{},nft:{}},r.slpUtxos.type1.mintBatons=e.utxos.filter(t=>{const e=!0===t.isValid,r=1===t.tokenType,i="minting-baton"===t.utxoType;return e&&r&&i}),r.slpUtxos.type1.tokens=e.utxos.filter(t=>{const e=!0===t.isValid,r=1===t.tokenType,i="token"===t.utxoType;return e&&r&&i}),r.slpUtxos.nft.groupMintBatons=e.utxos.filter(t=>{const e=!0===t.isValid,r=129===t.tokenType,i="minting-baton"===t.utxoType;return e&&r&&i}),r.slpUtxos.nft.groupTokens=e.utxos.filter(t=>{const e=!0===t.isValid,r=129===t.tokenType,i="token"===t.utxoType;return e&&r&&i}),r.slpUtxos.nft.tokens=e.utxos.filter(t=>{const e=!0===t.isValid,r=65===t.tokenType,i="token"===t.utxoType;return e&&r&&i}),o.push(r)}return o}catch(err){throw console.error("Error in bchjs.utxo.get()"),err}}findBiggestUtxo(t){let e=0,r=0;if(!Array.isArray(t))throw new Error("utxos input to findBiggestUtxo() must be an array");for(let i=0;ie&&(e=n.satoshis,r=i)}return t[r]}};let ___this_19;var _$ninsight_19=class{constructor(t){t&&(this.ninsightURL=t.ninsightURL?t.ninsightURL:"https://rest.bitcoin.com/v2"),this.axiosOptions={headers:{authorization:"Token "+this.apiToken,timeout:15e3}},___this_19=this}async utxo(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/address/utxo",{addresses:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/address/utxo",{addresses:t},___this_19.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async unconfirmed(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/address/unconfirmed",{addresses:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/address/unconfirmed",{addresses:t},___this_19.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async transactions(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/address/transactions",{addresses:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/address/transactions",{addresses:t},___this_19.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async txDetails(t){try{if("string"==typeof t)return(await _$axios_130.post(this.ninsightURL+"/transaction/details",{txids:[t]},___this_19.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_130.post(this.ninsightURL+"/transaction/details",{txids:t},___this_19.axiosOptions)).data;throw new Error("Transaction ID must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}},_$bchJs_6={};(function(t,e){_$bchJs_6=class{constructor(r){if(r&&r.restURL&&""!==r.restURL?this.restURL=r.restURL:t.env.RESTURL&&""!==t.env.RESTURL?this.restURL=t.env.RESTURL:this.restURL="https://api.fullstack.cash/v4/",this.apiToken="",r&&r.apiToken&&""!==r.apiToken?this.apiToken=r.apiToken:this.apiToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlODhhY2JmMDIyMWMxMDAxMmFkOTNmZiIsImVtYWlsIjoiY2hyaXMudHJvdXRuZXJAZ21haWwuY29tIiwiYXBpTGV2ZWwiOjQwLCJyYXRlTGltaXQiOjMsInBvaW50c1RvQ29uc3VtZSI6MTAwLCJkdXJhdGlvbiI6MzAsImlhdCI6MTYxNTQwNjU2MiwiZXhwIjoxNjE3OTk4NTYyfQ.B8ZQy2mUxlBJjuI4Y7uY_uL-1MVTABXABNmTIxUqRMM",this.authPass="",r&&r.authPass&&""!==r.authPass?this.authPass=r.authPass:t.env.BCHJSAUTHPASS&&""!==t.env.BCHJSAUTHPASS&&(this.authPass=t.env.BCHJSAUTHPASS),this.authToken="",this.authPass){const t="fullstackcash:"+this.authPass,r=e.from(t).toString("base64");this.authToken="Basic "+r}const i={restURL:this.restURL,apiToken:this.apiToken,authToken:this.authToken};this.Ninsight=new _$ninsight_19(r),this.Electrumx=new _$electrumx_12(i),this.Control=new _$control_9(i),this.Mining=new _$mining_17(i),this.RawTransactions=new _$rawTransactions_21(i),this.Address=new _$address_5(i),this.BitcoinCash=new _$bitcoincash_7(this.Address),this.Blockchain=new _$blockchain_8(i),this.Crypto=_$crypto_10,this.ECPair=_$ECPair_11,this.ECPair.setAddress(this.Address),this.encryption=new _$encryption_13(i),this.Generating=new _$generating_14(i),this.HDNode=new _$hdnode_15(this.Address),this.Mnemonic=new _$mnemonic_18(this.Address),this.Price=new _$price_20(i),this.Script=new _$script_23,this.TransactionBuilder=_$TransactionBuilder_30,this.TransactionBuilder.setAddress(this.Address),this.Util=new _$util_31(i),this.Schnorr=new _$schnorr_22(i),this.SLP=new _$slp_27(i),this.SLP.HDNode=this.HDNode,this.IPFS=new _$ipfs_16,this.Utxo=new _$utxo_32(i)}}}).call(this,_$browser_550,_$buffer_460({}).Buffer);var _$core_230={};(function(t){var r;r=function(){var r=r||function(r,i){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==t&&t.crypto&&(n=t.crypto),!n)try{n=_$cryptoBrowserify_469({})}catch(err){}var o=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(err){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(err){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),s={},u=s.lib={},h=u.Base={extend:function(t){var e=a(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=u.WordArray=h.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o>>2]>>>24-o%4*8&255;e[i+o>>>2]|=a<<24-(i+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=r.ceil(e/4)},clone:function(){var t=h.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new f.init(r,e/2)}},_=c.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new f.init(r,e)}},d=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(_.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return _.parse(unescape(encodeURIComponent(t)))}},p=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e,i=this._data,n=i.words,o=i.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=t?r.ceil(s):r.max((0|s)-this._minBufferSize,0))*a,h=r.min(4*u,o);if(u){for(var c=0;c>>2]|=t[n]<<24-n%4*8;r.call(this,i,e)}else r.apply(this,arguments)}).prototype=e}}(),t.lib.WordArray},"object"==typeof _$libTypedarrays_237?_$libTypedarrays_237=_$libTypedarrays_237=__factory_237(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_237):__factory_237(__root_237.CryptoJS);var _$encUtf16_232={},__root_232,__factory_232;__root_232=this,__factory_232=function(t){return function(){var e=t,r=e.lib.WordArray,i=e.enc;function n(t){return t<<8&4278255360|t>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>1]|=t.charCodeAt(n)<<16-n%2*16;return r.create(i,2*e)}},i.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],o=0;o>>2]>>>16-o%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(t){for(var e=t.length,i=[],o=0;o>>1]|=n(t.charCodeAt(o)<<16-o%2*16);return r.create(i,2*e)}}}(),t.enc.Utf16},"object"==typeof _$encUtf16_232?_$encUtf16_232=_$encUtf16_232=__factory_232(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_232):__factory_232(__root_232.CryptoJS);var _$encBase64_231={},__root_231,__factory_231;__root_231=this,__factory_231=function(t){return r=(e=t).lib.WordArray,e.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,i=this._map;t.clamp();for(var n=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var u=i.charAt(64);if(u)for(;n.length%4;)n.push(u);return n.join("")},parse:function(t){var e=t.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return r.create(n,o)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},t.enc.Base64;var e,r},"object"==typeof _$encBase64_231?_$encBase64_231=_$encBase64_231=__factory_231(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_231):__factory_231(__root_231.CryptoJS);var _$md5_238={},__root_238,__factory_238;__root_238=this,__factory_238=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=e+r,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=t[e+0],u=t[e+1],_=t[e+2],d=t[e+3],p=t[e+4],m=t[e+5],b=t[e+6],g=t[e+7],v=t[e+8],y=t[e+9],w=t[e+10],M=t[e+11],S=t[e+12],$=t[e+13],E=t[e+14],k=t[e+15],A=o[0],B=o[1],x=o[2],T=o[3];A=h(A,B,x,T,a,7,s[0]),T=h(T,A,B,x,u,12,s[1]),x=h(x,T,A,B,_,17,s[2]),B=h(B,x,T,A,d,22,s[3]),A=h(A,B,x,T,p,7,s[4]),T=h(T,A,B,x,m,12,s[5]),x=h(x,T,A,B,b,17,s[6]),B=h(B,x,T,A,g,22,s[7]),A=h(A,B,x,T,v,7,s[8]),T=h(T,A,B,x,y,12,s[9]),x=h(x,T,A,B,w,17,s[10]),B=h(B,x,T,A,M,22,s[11]),A=h(A,B,x,T,S,7,s[12]),T=h(T,A,B,x,$,12,s[13]),x=h(x,T,A,B,E,17,s[14]),A=f(A,B=h(B,x,T,A,k,22,s[15]),x,T,u,5,s[16]),T=f(T,A,B,x,b,9,s[17]),x=f(x,T,A,B,M,14,s[18]),B=f(B,x,T,A,a,20,s[19]),A=f(A,B,x,T,m,5,s[20]),T=f(T,A,B,x,w,9,s[21]),x=f(x,T,A,B,k,14,s[22]),B=f(B,x,T,A,p,20,s[23]),A=f(A,B,x,T,y,5,s[24]),T=f(T,A,B,x,E,9,s[25]),x=f(x,T,A,B,d,14,s[26]),B=f(B,x,T,A,v,20,s[27]),A=f(A,B,x,T,$,5,s[28]),T=f(T,A,B,x,_,9,s[29]),x=f(x,T,A,B,g,14,s[30]),A=c(A,B=f(B,x,T,A,S,20,s[31]),x,T,m,4,s[32]),T=c(T,A,B,x,v,11,s[33]),x=c(x,T,A,B,M,16,s[34]),B=c(B,x,T,A,E,23,s[35]),A=c(A,B,x,T,u,4,s[36]),T=c(T,A,B,x,p,11,s[37]),x=c(x,T,A,B,g,16,s[38]),B=c(B,x,T,A,w,23,s[39]),A=c(A,B,x,T,$,4,s[40]),T=c(T,A,B,x,a,11,s[41]),x=c(x,T,A,B,d,16,s[42]),B=c(B,x,T,A,b,23,s[43]),A=c(A,B,x,T,y,4,s[44]),T=c(T,A,B,x,S,11,s[45]),x=c(x,T,A,B,k,16,s[46]),A=l(A,B=c(B,x,T,A,_,23,s[47]),x,T,a,6,s[48]),T=l(T,A,B,x,g,10,s[49]),x=l(x,T,A,B,E,15,s[50]),B=l(B,x,T,A,m,21,s[51]),A=l(A,B,x,T,S,6,s[52]),T=l(T,A,B,x,d,10,s[53]),x=l(x,T,A,B,w,15,s[54]),B=l(B,x,T,A,u,21,s[55]),A=l(A,B,x,T,v,6,s[56]),T=l(T,A,B,x,k,10,s[57]),x=l(x,T,A,B,b,15,s[58]),B=l(B,x,T,A,$,21,s[59]),A=l(A,B,x,T,p,6,s[60]),T=l(T,A,B,x,M,10,s[61]),x=l(x,T,A,B,_,15,s[62]),B=l(B,x,T,A,y,21,s[63]),o[0]=o[0]+A|0,o[1]=o[1]+B|0,o[2]=o[2]+x|0,o[3]=o[3]+T|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var o=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,h=0;h<4;h++){var f=u[h];u[h]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,r,i,n,o,a){var s=t+(e&r|~e&i)+n+a;return(s<>>32-o)+e}function f(t,e,r,i,n,o,a){var s=t+(e&i|r&~i)+n+a;return(s<>>32-o)+e}function c(t,e,r,i,n,o,a){var s=t+(e^r^i)+n+a;return(s<>>32-o)+e}function l(t,e,r,i,n,o,a){var s=t+(r^(e|~i))+n+a;return(s<>>32-o)+e}r.MD5=o._createHelper(u),r.HmacMD5=o._createHmacHelper(u)}(Math),t.MD5},"object"==typeof _$md5_238?_$md5_238=_$md5_238=__factory_238(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_238):__factory_238(__root_238.CryptoJS);var _$sha1_254={},__root_254,__factory_254;__root_254=this,__factory_254=function(t){var e,r,i,n,o,a,s;return r=(e=t).lib,i=r.WordArray,n=r.Hasher,o=e.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=0;h<80;h++){if(h<16)a[h]=0|t[e+h];else{var f=a[h-3]^a[h-8]^a[h-14]^a[h-16];a[h]=f<<1|f>>>31}var c=(i<<5|i>>>27)+u+a[h];c+=h<20?1518500249+(n&o|~n&s):h<40?1859775393+(n^o^s):h<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,u=s,s=o,o=n<<30|n>>>2,n=i,i=c}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(i+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=n._createHelper(s),e.HmacSHA1=n._createHmacHelper(s),t.SHA1},"object"==typeof _$sha1_254?_$sha1_254=_$sha1_254=__factory_254(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_254):__factory_254(__root_254.CryptoJS);var _$sha256_256={},__root_256,__factory_256;__root_256=this,__factory_256=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=[],u=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(s[n]=r(e.pow(i,.5))),u[n]=r(e.pow(i,1/3)),n++),i++}();var h=[],f=a.SHA256=o.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],f=r[5],c=r[6],l=r[7],_=0;_<64;_++){if(_<16)h[_]=0|t[e+_];else{var d=h[_-15],p=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,m=h[_-2],b=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;h[_]=p+h[_-7]+b+h[_-16]}var g=i&n^i&o^n&o,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),y=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&c)+u[_]+h[_];l=c,c=f,f=s,s=a+y|0,a=o,o=n,n=i,i=y+(v+g)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+c|0,r[7]=r[7]+l|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=o._createHelper(f),r.HmacSHA256=o._createHmacHelper(f)}(Math),t.SHA256},"object"==typeof _$sha256_256?_$sha256_256=_$sha256_256=__factory_256(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_256):__factory_256(__root_256.CryptoJS);var _$sha224_255={},__root_255,__factory_255;__root_255=this,__factory_255=function(t){var e,r,i,n,o;return r=(e=t).lib.WordArray,i=e.algo,n=i.SHA256,o=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=n._createHelper(o),e.HmacSHA224=n._createHmacHelper(o),t.SHA224},"object"==typeof _$sha224_255?_$sha224_255=_$sha224_255=__factory_255(_$core_230,_$sha256_256):"function"==typeof define&&define.amd?define(["./core","./sha256"],__factory_255):__factory_255(__root_255.CryptoJS);var _$sha512_259={},__root_259,__factory_259;__root_259=this,__factory_259=function(t){return function(){var e=t,r=e.lib.Hasher,i=e.x64,n=i.Word,o=i.WordArray,a=e.algo;function s(){return n.create.apply(n,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],h=[];!function(){for(var t=0;t<80;t++)h[t]=s()}();var f=a.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],f=r[5],c=r[6],l=r[7],_=i.high,d=i.low,p=n.high,m=n.low,b=o.high,g=o.low,v=a.high,y=a.low,w=s.high,M=s.low,S=f.high,$=f.low,E=c.high,k=c.low,A=l.high,B=l.low,x=_,T=d,R=p,P=m,I=b,C=g,O=v,N=y,L=w,U=M,D=S,z=$,j=E,H=k,q=A,F=B,K=0;K<80;K++){var V,G,W=h[K];if(K<16)G=W.high=0|t[e+2*K],V=W.low=0|t[e+2*K+1];else{var Z=h[K-15],Y=Z.high,J=Z.low,X=(Y>>>1|J<<31)^(Y>>>8|J<<24)^Y>>>7,Q=(J>>>1|Y<<31)^(J>>>8|Y<<24)^(J>>>7|Y<<25),tt=h[K-2],et=tt.high,rt=tt.low,it=(et>>>19|rt<<13)^(et<<3|rt>>>29)^et>>>6,nt=(rt>>>19|et<<13)^(rt<<3|et>>>29)^(rt>>>6|et<<26),ot=h[K-7],at=ot.high,st=ot.low,ut=h[K-16],ht=ut.high,ft=ut.low;G=(G=(G=X+at+((V=Q+st)>>>0>>0?1:0))+it+((V+=nt)>>>0>>0?1:0))+ht+((V+=ft)>>>0>>0?1:0),W.high=G,W.low=V}var ct,lt=L&D^~L&j,_t=U&z^~U&H,dt=x&R^x&I^R&I,pt=T&P^T&C^P&C,mt=(x>>>28|T<<4)^(x<<30|T>>>2)^(x<<25|T>>>7),bt=(T>>>28|x<<4)^(T<<30|x>>>2)^(T<<25|x>>>7),gt=(L>>>14|U<<18)^(L>>>18|U<<14)^(L<<23|U>>>9),vt=(U>>>14|L<<18)^(U>>>18|L<<14)^(U<<23|L>>>9),yt=u[K],wt=yt.high,Mt=yt.low,St=q+gt+((ct=F+vt)>>>0>>0?1:0),$t=bt+pt;q=j,F=H,j=D,H=z,D=L,z=U,L=O+(St=(St=(St=St+lt+((ct+=_t)>>>0<_t>>>0?1:0))+wt+((ct+=Mt)>>>0>>0?1:0))+G+((ct+=V)>>>0>>0?1:0))+((U=N+ct|0)>>>0>>0?1:0)|0,O=I,N=C,I=R,C=P,R=x,P=T,x=St+(mt+dt+($t>>>0>>0?1:0))+((T=ct+$t|0)>>>0>>0?1:0)|0}d=i.low=d+T,i.high=_+x+(d>>>0>>0?1:0),m=n.low=m+P,n.high=p+R+(m>>>0

>>0?1:0),g=o.low=g+C,o.high=b+I+(g>>>0>>0?1:0),y=a.low=y+N,a.high=v+O+(y>>>0>>0?1:0),M=s.low=M+U,s.high=w+L+(M>>>0>>0?1:0),$=f.low=$+z,f.high=S+D+($>>>0>>0?1:0),k=c.low=k+H,c.high=E+j+(k>>>0>>0?1:0),B=l.low=B+F,l.high=A+q+(B>>>0>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(i+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=r._createHelper(f),e.HmacSHA512=r._createHmacHelper(f)}(),t.SHA512},"object"==typeof _$sha512_259?_$sha512_259=_$sha512_259=__factory_259(_$core_230,_$x64Core_261):"function"==typeof define&&define.amd?define(["./core","./x64-core"],__factory_259):__factory_259(__root_259.CryptoJS);var _$sha384_258={},__root_258,__factory_258;__root_258=this,__factory_258=function(t){var e,r,i,n,o,a,s;return r=(e=t).x64,i=r.Word,n=r.WordArray,o=e.algo,a=o.SHA512,s=o.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s),t.SHA384},"object"==typeof _$sha384_258?_$sha384_258=_$sha384_258=__factory_258(_$core_230,_$x64Core_261,_$sha512_259):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],__factory_258):__factory_258(__root_258.CryptoJS);var _$sha3_257={},__root_257,__factory_257;__root_257=this,__factory_257=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.x64.Word,s=r.algo,u=[],h=[],f=[];!function(){for(var t=1,e=0,r=0;r<24;r++){u[t+5*e]=(r+1)*(r+2)/2%64;var i=(2*t+3*e)%5;t=e%5,e=i}for(t=0;t<5;t++)for(e=0;e<5;e++)h[t+5*e]=e+(2*t+3*e)%5*5;for(var n=1,o=0;o<24;o++){for(var s=0,c=0,l=0;l<7;l++){if(1&n){var _=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(B=r[n]).high^=a,B.low^=o}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var _=0,d=0,p=0;p<5;p++)_^=(B=r[l+5*p]).high,d^=B.low;var m=c[l];m.high=_,m.low=d}for(l=0;l<5;l++){var b=c[(l+4)%5],g=c[(l+1)%5],v=g.high,y=g.low;for(_=b.high^(v<<1|y>>>31),d=b.low^(y<<1|v>>>31),p=0;p<5;p++)(B=r[l+5*p]).high^=_,B.low^=d}for(var w=1;w<25;w++){var M=(B=r[w]).high,S=B.low,$=u[w];$<32?(_=M<<$|S>>>32-$,d=S<<$|M>>>32-$):(_=S<<$-32|M>>>64-$,d=M<<$-32|S>>>64-$);var E=c[h[w]];E.high=_,E.low=d}var k=c[0],A=r[0];for(k.high=A.high,k.low=A.low,l=0;l<5;l++)for(p=0;p<5;p++){var B=r[w=l+5*p],x=c[w],T=c[(l+1)%5+5*p],R=c[(l+2)%5+5*p];B.high=x.high^~T.high&R.high,B.low=x.low^~T.low&R.low}B=r[0];var P=f[s];B.high^=P.high,B.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words,i=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,h=[],f=0;f>>24)|4278255360&(l<<24|l>>>8),_=16711935&(_<<8|_>>>24)|4278255360&(_<<24|_>>>8),h.push(_),h.push(l)}return new n.init(h,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),r=0;r<25;r++)e[r]=e[r].clone();return t}});r.SHA3=o._createHelper(l),r.HmacSHA3=o._createHmacHelper(l)}(Math),t.SHA3},"object"==typeof _$sha3_257?_$sha3_257=_$sha3_257=__factory_257(_$core_230,_$x64Core_261):"function"==typeof define&&define.amd?define(["./core","./x64-core"],__factory_257):__factory_257(__root_257.CryptoJS);var _$ripemd160_253={},__root_253,__factory_253;__root_253=this,__factory_253=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=n.create([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=n.create([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]),h=n.create([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]),f=n.create([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=n.create([0,1518500249,1859775393,2400959708,2840853838]),l=n.create([1352829926,1548603684,1836072691,2053994217,0]),_=a.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=e+r,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o,a,_,y,w,M,S,$,E,k,A,B=this._hash.words,x=c.words,T=l.words,R=s.words,P=u.words,I=h.words,C=f.words;for(M=o=B[0],S=a=B[1],$=_=B[2],E=y=B[3],k=w=B[4],r=0;r<80;r+=1)A=o+t[e+R[r]]|0,A+=r<16?d(a,_,y)+x[0]:r<32?p(a,_,y)+x[1]:r<48?m(a,_,y)+x[2]:r<64?b(a,_,y)+x[3]:g(a,_,y)+x[4],A=(A=v(A|=0,I[r]))+w|0,o=w,w=y,y=v(_,10),_=a,a=A,A=M+t[e+P[r]]|0,A+=r<16?g(S,$,E)+T[0]:r<32?b(S,$,E)+T[1]:r<48?m(S,$,E)+T[2]:r<64?p(S,$,E)+T[3]:d(S,$,E)+T[4],A=(A=v(A|=0,C[r]))+k|0,M=k,k=E,E=v($,10),$=S,S=A;A=B[1]+_+E|0,B[1]=B[2]+y+k|0,B[2]=B[3]+w+M|0,B[3]=B[4]+o+S|0,B[4]=B[0]+a+$|0,B[0]=A},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process();for(var n=this._hash,o=n.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return n},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function d(t,e,r){return t^e^r}function p(t,e,r){return t&e|~t&r}function m(t,e,r){return(t|~e)^r}function b(t,e,r){return t&r|e&~r}function g(t,e,r){return t^(e|~r)}function v(t,e){return t<>>32-e}r.RIPEMD160=o._createHelper(_),r.HmacRIPEMD160=o._createHmacHelper(_)}(Math),t.RIPEMD160},"object"==typeof _$ripemd160_253?_$ripemd160_253=_$ripemd160_253=__factory_253(_$core_230):"function"==typeof define&&define.amd?define(["./core"],__factory_253):__factory_253(__root_253.CryptoJS);var _$hmac_235={},__root_235,__factory_235;__root_235=this,__factory_235=function(t){var e,r,i;r=(e=t).lib.Base,i=e.enc.Utf8,e.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),a=this._iKey=e.clone(),s=o.words,u=a.words,h=0;h>>2];t.sigBytes-=e}},p=(i.BlockCipher=f.extend({cfg:f.cfg.extend({mode:_,padding:d}),reset:function(){var t;f.reset.call(this);var e=this.cfg,r=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(i,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),i.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),m=(r.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(e):e).toString(u)},parse:function(t){var e,r=u.parse(t),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=o.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),p.create({ciphertext:r,salt:e})}},b=i.SerializableCipher=n.extend({cfg:n.extend({format:m}),encrypt:function(t,e,r,i){i=this.cfg.extend(i);var n=t.createEncryptor(r,i),o=n.finalize(e),a=n.cfg;return p.create({ciphertext:o,key:r,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,r,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(r,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),g=(r.kdf={}).OpenSSL={execute:function(t,e,r,i){i||(i=o.random(8));var n=h.create({keySize:e+r}).compute(t,i),a=o.create(n.words.slice(e),4*r);return n.sigBytes=4*e,p.create({key:n,iv:a,salt:i})}},v=i.PasswordBasedCipher=b.extend({cfg:b.cfg.extend({kdf:g}),encrypt:function(t,e,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,t.keySize,t.ivSize);i.iv=n.iv;var o=b.encrypt.call(this,t,e,n.key,i);return o.mixIn(n),o},decrypt:function(t,e,r,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=i.kdf.execute(r,t.keySize,t.ivSize,e.salt);return i.iv=n.iv,b.decrypt.call(this,t,e,n.key,i)}})}()},"object"==typeof _$cipherCore_229?_$cipherCore_229=_$cipherCore_229=__factory_229(_$core_230,_$evpkdf_233):"function"==typeof define&&define.amd?define(["./core","./evpkdf"],__factory_229):__factory_229(__root_229.CryptoJS);var _$modeCfb_239={},__root_239,__factory_239;__root_239=this,__factory_239=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function r(t,e,r,i){var n,o=this._iv;o?(n=o.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var e=t>>16&255,r=t>>8&255,i=255&t;255===e?(e=0,255===r?(r=0,255===i?i=0:++i):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=i}else t+=1<<24;return t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),function(t){0===(t[0]=r(t[0]))&&(t[1]=r(t[1]))}(a);var s=a.slice(0);i.encryptBlock(s,0);for(var u=0;u>>2]|=n<<24-o%4*8,t.sigBytes+=n},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923},"object"==typeof _$padAnsix923_244?_$padAnsix923_244=_$padAnsix923_244=__factory_244(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_244):__factory_244(__root_244.CryptoJS);var _$padIso10126_245={},__root_245,__factory_245;__root_245=this,__factory_245=function(t){return t.pad.Iso10126={pad:function(e,r){var i=4*r,n=i-e.sigBytes%i;e.concat(t.lib.WordArray.random(n-1)).concat(t.lib.WordArray.create([n<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126},"object"==typeof _$padIso10126_245?_$padIso10126_245=_$padIso10126_245=__factory_245(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_245):__factory_245(__root_245.CryptoJS);var _$padIso97971_246={},__root_246,__factory_246;__root_246=this,__factory_246=function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971},"object"==typeof _$padIso97971_246?_$padIso97971_246=_$padIso97971_246=__factory_246(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_246):__factory_246(__root_246.CryptoJS);var _$padZeropadding_248={},__root_248,__factory_248;__root_248=this,__factory_248=function(t){return t.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){var e=t.words,r=t.sigBytes-1;for(r=t.sigBytes-1;r>=0;r--)if(e[r>>>2]>>>24-r%4*8&255){t.sigBytes=r+1;break}}},t.pad.ZeroPadding},"object"==typeof _$padZeropadding_248?_$padZeropadding_248=_$padZeropadding_248=__factory_248(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_248):__factory_248(__root_248.CryptoJS);var _$padNopadding_247={},__root_247,__factory_247;__root_247=this,__factory_247=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding},"object"==typeof _$padNopadding_247?_$padNopadding_247=_$padNopadding_247=__factory_247(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_247):__factory_247(__root_247.CryptoJS);var _$formatHex_234={},__root_234,__factory_234;__root_234=this,__factory_234=function(t){var e,r,i;return r=(e=t).lib.CipherParams,i=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(i)},parse:function(t){var e=i.parse(t);return r.create({ciphertext:e})}},t.format.Hex},"object"==typeof _$formatHex_234?_$formatHex_234=_$formatHex_234=__factory_234(_$core_230,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_234):__factory_234(__root_234.CryptoJS);var _$aes_228={},__root_228,__factory_228;__root_228=this,__factory_228=function(t){return function(){var e=t,r=e.lib.BlockCipher,i=e.algo,n=[],o=[],a=[],s=[],u=[],h=[],f=[],c=[],l=[],_=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,i=0;for(e=0;e<256;e++){var d=i^i<<1^i<<2^i<<3^i<<4;d=d>>>8^255&d^99,n[r]=d,o[d]=r;var p=t[r],m=t[p],b=t[m],g=257*t[d]^16843008*d;a[r]=g<<24|g>>>8,s[r]=g<<16|g>>>16,u[r]=g<<8|g>>>24,h[r]=g,g=16843009*b^65537*m^257*p^16843008*r,f[d]=g<<24|g>>>8,c[d]=g<<16|g>>>16,l[d]=g<<8|g>>>24,_[d]=g,r?(r=p^t[t[t[b^p]]],i^=t[t[i]]):r=i=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],p=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,i=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a6&&a%r==4&&(h=n[h>>>24]<<24|n[h>>>16&255]<<16|n[h>>>8&255]<<8|n[255&h]):(h=n[(h=h<<8|h>>>24)>>>24]<<24|n[h>>>16&255]<<16|n[h>>>8&255]<<8|n[255&h],h^=d[a/r|0]<<24),o[a]=o[a-r]^h);for(var s=this._invKeySchedule=[],u=0;u>>24]]^c[n[h>>>16&255]]^l[n[h>>>8&255]]^_[n[255&h]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,s,u,h,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,f,c,l,_,o),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,i,n,o,a,s){for(var u=this._nRounds,h=t[e]^r[0],f=t[e+1]^r[1],c=t[e+2]^r[2],l=t[e+3]^r[3],_=4,d=1;d>>24]^n[f>>>16&255]^o[c>>>8&255]^a[255&l]^r[_++],m=i[f>>>24]^n[c>>>16&255]^o[l>>>8&255]^a[255&h]^r[_++],b=i[c>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&f]^r[_++],g=i[l>>>24]^n[h>>>16&255]^o[f>>>8&255]^a[255&c]^r[_++];h=p,f=m,c=b,l=g}p=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^r[_++],m=(s[f>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[_++],b=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^r[_++],g=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&c])^r[_++],t[e]=p,t[e+1]=m,t[e+2]=b,t[e+3]=g},keySize:8});e.AES=r._createHelper(p)}(),t.AES},"object"==typeof _$aes_228?_$aes_228=_$aes_228=__factory_228(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_228):__factory_228(__root_228.CryptoJS);var _$tripledes_260={},__root_260,__factory_260;__root_260=this,__factory_260=function(t){return function(){var e=t,r=e.lib,i=r.WordArray,n=r.BlockCipher,o=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=n.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var i=a[r]-1;e[r]=t[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],o=0;o<16;o++){var h=n[o]=[],f=u[o];for(r=0;r<24;r++)h[r/6|0]|=e[(s[r]-1+f)%28]<<31-r%6,h[4+(r/6|0)]|=e[28+(s[r+24]-1+f)%28]<<31-r%6;for(h[0]=h[0]<<1|h[0]>>>31,r=1;r<7;r++)h[r]=h[r]>>>4*(r-1)+3;h[7]=h[7]<<5|h[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=n[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],l.call(this,4,252645135),l.call(this,16,65535),_.call(this,2,858993459),_.call(this,8,16711935),l.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],o=this._lBlock,a=this._rBlock,s=0,u=0;u<8;u++)s|=h[u][((a^n[u])&f[u])>>>0];this._lBlock=a,this._rBlock=o^s}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,l.call(this,1,1431655765),_.call(this,8,16711935),_.call(this,2,858993459),l.call(this,16,65535),l.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function l(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),n=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(i.create(e)),this._des2=c.createEncryptor(i.create(r)),this._des3=c.createEncryptor(i.create(n))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(d)}(),t.TripleDES},"object"==typeof _$tripledes_260?_$tripledes_260=_$tripledes_260=__factory_260(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_260):__factory_260(__root_260.CryptoJS);var _$rc4_252={},__root_252,__factory_252;__root_252=this,__factory_252=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=i.RC4=r.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var o=0;n<256;n++){var a=n%r,s=e[a>>>2]>>>24-a%4*8&255;o=(o+i[n]+s)%256;var u=i[n];i[n]=i[o],i[o]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var t=this._S,e=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+t[e=(e+1)%256])%256;var o=t[e];t[e]=t[r],t[r]=o,i|=t[(t[e]+t[r])%256]<<24-8*n}return this._i=e,this._j=r,i}e.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)o.call(this)}});e.RC4Drop=r._createHelper(a)}(),t.RC4},"object"==typeof _$rc4_252?_$rc4_252=_$rc4_252=__factory_252(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_252):__factory_252(__root_252.CryptoJS);var _$rabbit_251={},__root_251,__factory_251;__root_251=this,__factory_251=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=[],o=[],a=[],s=i.Rabbit=r.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)u.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(e){var o=e.words,a=o[0],s=o[1],h=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),c=h>>>16|4294901760&f,l=f<<16|65535&h;for(n[0]^=h,n[1]^=c,n[2]^=f,n[3]^=l,n[4]^=h,n[5]^=c,n[6]^=f,n[7]^=l,r=0;r<4;r++)u.call(this)}},_doProcessBlock:function(t,e){var r=this._X;u.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,r=0;r<8;r++)o[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0,r=0;r<8;r++){var i=t[r]+e[r],n=65535&i,s=i>>>16,u=((n*n>>>17)+n*s>>>15)+s*s,h=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=u^h}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=r._createHelper(s)}(),t.Rabbit},"object"==typeof _$rabbit_251?_$rabbit_251=_$rabbit_251=__factory_251(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_251):__factory_251(__root_251.CryptoJS);var _$rabbitLegacy_250={},__root_250,__factory_250;__root_250=this,__factory_250=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=[],o=[],a=[],s=i.RabbitLegacy=r.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(e){var o=e.words,a=o[0],s=o[1],h=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),c=h>>>16|4294901760&f,l=f<<16|65535&h;for(i[0]^=h,i[1]^=c,i[2]^=f,i[3]^=l,i[4]^=h,i[5]^=c,i[6]^=f,i[7]^=l,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var r=this._X;u.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,r=0;r<8;r++)o[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0,r=0;r<8;r++){var i=t[r]+e[r],n=65535&i,s=i>>>16,u=((n*n>>>17)+n*s>>>15)+s*s,h=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=u^h}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=r._createHelper(s)}(),t.RabbitLegacy},"object"==typeof _$rabbitLegacy_250?_$rabbitLegacy_250=_$rabbitLegacy_250=__factory_250(_$core_230,_$encBase64_231,_$md5_238,_$evpkdf_233,_$cipherCore_229):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_250):__factory_250(__root_250.CryptoJS);var _$cryptoJs_236={},__root_236,__factory_236;__root_236=this,__factory_236=function(t){return t},"object"==typeof _$cryptoJs_236?_$cryptoJs_236=_$cryptoJs_236=__factory_236(_$core_230,_$x64Core_261,_$libTypedarrays_237,_$encUtf16_232,_$encBase64_231,_$md5_238,_$sha1_254,_$sha256_256,_$sha224_255,_$sha512_259,_$sha384_258,_$sha3_257,_$ripemd160_253,_$hmac_235,_$pbkdf2_249,_$evpkdf_233,_$cipherCore_229,_$modeCfb_239,_$modeCtr_241,_$modeCtrGladman_240,_$modeOfb_243,_$modeEcb_242,_$padAnsix923_244,_$padIso10126_245,_$padIso97971_246,_$padZeropadding_248,_$padNopadding_247,_$formatHex_234,_$aes_228,_$tripledes_260,_$rc4_252,_$rabbit_251,_$rabbitLegacy_250):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],__factory_236):__root_236.CryptoJS=__factory_236(__root_236.CryptoJS);const orgs=[{org:"psf",description:"Permissionless Software Foundation",website:"https://psfoundation.cash",addresses:{donations:"bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr"}},{org:"abc",description:"Bitcoin ABC",website:"https://www.bitcoinabc.org/",addresses:{donations:"bitcoincash:qqeht8vnwag20yv8dvtcrd4ujx09fwxwsqqqw93w88"}},{org:"bchd",description:"BCHD full node in Go",website:"https://bchd.cash/",addresses:{donations:"bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx"}}];var _$bchDonation_159=function(t){const e=orgs.filter(e=>e.org===t);if(!e)throw new Error("Could not find an organization with that handle.");if(e.length>1)throw new Error("Multiple organizations were found!");return e[0].addresses};let ___this_2;const PSF_DONATION=2e3;var _$sendBch_2=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.bchjs=new _$bchJs_6(t),___this_2=this}async sendBch(t,e,r){try{const i=await this.createTransaction(t,e,r);return await ___this_2.bchjs.RawTransactions.sendRawTransaction(i.hex)}catch(err){throw console.error("Error in send-bch.js/sendBch()"),err}}async createTransaction(t,e,r){try{if(!r||0===r.length)throw new Error("UTXO list is empty");e.fee||(e.fee=1);const{necessaryUtxos:i,change:n}=___this_2.getNecessaryUtxosAndChange(t,r,e.fee),o=new ___this_2.bchjs.TransactionBuilder;i.forEach(t=>{o.addInput(t.tx_hash,t.tx_pos)}),t.forEach(t=>{o.addOutput(t.address,t.amountSat)}),o.addOutput(_$bchDonation_159("psf").donations,PSF_DONATION),console.log("change: "+n),n&&n>546&&o.addOutput(e.cashAddress,n);const a=await ___this_2.getKeyPairFromMnemonic(e);i.forEach((t,e)=>{o.sign(e,a,void 0,o.hashTypes.SIGHASH_ALL,t.value)});const s=o.build();return{hex:s.toHex(),txid:s.getId()}}catch(err){throw console.error("Error in send-bch.js/createTransaction()"),err}}getNecessaryUtxosAndChange(t,e,r=1){const i=this.sortUtxosBySize(e,"ASCENDING"),n=___this_2.calculateFee(0,t.length+1,r);let o=t.reduce((t,e)=>t+e.amountSat,0)+n+PSF_DONATION,a=0;const s=[];for(const h of i)if(s.push(h),(a+=h.value)>=(o+=148))break;const u=a-o;if(u<0)throw console.error(`Available satoshis (${a}) below needed satoshis (${o}).`),new Error("Insufficient balance");return{necessaryUtxos:s,change:u}}sortUtxosBySize(t,e="ASCENDING"){return"ASCENDING"===e?t.sort((t,e)=>t.value-e.value):t.sort((t,e)=>e.value-t.value)}calculateFee(t,e,r){try{const i=___this_2.bchjs.BitcoinCash.getByteCount({P2PKH:t},{P2PKH:e+1}),n=Math.ceil(i*r);if(isNaN(n))throw new Error("Invalid input. Fee could not be calculated.");return n}catch(err){throw console.error("Error in send-bch.js/calculateFee()"),err}}async getKeyPairFromMnemonic(t){const e=await ___this_2.bchjs.Mnemonic.toSeed(t.mnemonic),r=___this_2.bchjs.HDNode.fromSeed(e),i=___this_2.bchjs.HDNode.derivePath(r,t.hdPath);return ___this_2.bchjs.HDNode.toKeyPair(i)}async sendAllBch(t,e,r){try{const i=await this.createSendAllTx(t,e,r);return await ___this_2.bchjs.RawTransactions.sendRawTransaction(i.hex)}catch(err){throw console.error("Error in send-bch.js/sendAllBch()"),err}}async createSendAllTx(t,e,r){try{if(!t||"string"!=typeof t)throw new Error("Address to send must be a bch address");if(!r||0===r.length)throw new Error("UTXO list is empty");const i=new ___this_2.bchjs.TransactionBuilder;e.fee||(e.fee=1);const n=e.fee;let o=0,a=this.calculateFee(0,2,n);a+=PSF_DONATION,r.forEach(t=>{o+=t.value,a+=148,i.addInput(t.tx_hash,t.tx_pos)}),i.addOutput(t,o-a),i.addOutput(_$bchDonation_159("psf").donations,PSF_DONATION);const s=await ___this_2.getKeyPairFromMnemonic(e);r.forEach((t,e)=>{i.sign(e,s,void 0,i.hashTypes.SIGHASH_ALL,t.value)});const u=i.build();return{hex:u.toHex(),txid:u.getId()}}catch(err){throw console.error("Error in send-bch.js/createSendAllTx()"),err}}};let ___this_4;var _$utxos_4=class{constructor(t){this.bchjs=new _$bchJs_6(t),this.utxoStore=[],this.bchUtxos=[],this.tokenUtxos=[],this.temp=[],___this_4=this}async getUtxos(t){try{const e=await ___this_4.bchjs.Electrumx.utxo(t);if(!e.success)throw new Error("Could not get UTXOs for "+t);return e.utxos}catch(err){throw console.error("Error in utxos.js/getUtxos()"),err}}async hydrate(t){try{if(!Array.isArray(t))throw new Error("Input must be an array");const e=20,r=await ___this_4.getArrayChunks(t,e);let i=[];for(let t=0;t(t.tokenQty&&(t.tokenQty=Number(t.tokenQty)),t)),this.utxoStore=r,this.getBchUtxos(),this.getTokenUtxos(),this.utxoStore}catch(err){throw console.error("Error in utxos.js/initUtxoStore()"),err}}getBchUtxos(){try{const t=this.utxoStore.filter(t=>!1===t.isValid);return this.bchUtxos=t,t}catch(err){throw console.log("Error in getBchUtxos()"),err}}getTokenUtxos(){try{const t=this.utxoStore.filter(t=>t.isValid);return this.tokenUtxos=t,t}catch(err){throw console.log("Error in getTokenUtxos()"),err}}diffUtxos(t){try{const e=___this_4.utxoStore,r=[];for(let i=0;i{if(!t.isValid||"token"!==t.utxoType)return;const r=e.findIndex(e=>e.tokenId===t.tokenId);if(r<0){const r={tokenId:t.tokenId,ticker:t.tokenTicker,name:t.tokenName,decimals:t.decimals,tokenType:t.tokenType,url:t.tokenDocumentUrl,qty:Number(t.tokenQty)};e.push(r)}else e[r].qty+=Number(t.tokenQty)}),e}catch(err){throw console.error("Error in tokens.js/listTokensFromUtxos()"),err}}async sendTokens(t,r,i,n,o=1){try{const a=await this.createTransaction(t,r,i,n,o);return await e.bchjs.RawTransactions.sendRawTransaction(a.hex)}catch(err){throw console.error("Error in tokens.js/sendTokens()"),err}}async createTransaction(r,i,n,o,a=1){try{if(!n||0===n.length)throw new Error("BCH UTXO list is empty");if(!o||0===o.length)throw new Error("Token UTXO list is empty");const s=r.tokenId;o=o.filter(t=>t.tokenId===s&&"token"===t.utxoType);const u=[{address:i.cashAddress,amountSat:500+50*a}],{necessaryUtxos:h,change:f}=e.sendBch.getNecessaryUtxosAndChange(u,n,a),c=new e.bchjs.TransactionBuilder;o.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)}),h.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)});let l={};if(1===o[0].tokenType)l=await e.bchjs.SLP.TokenType1.generateSendOpReturn(o,r.qty);else if(65===o[0].tokenType)l=await e.bchjs.SLP.NFT1.generateNFTChildSendOpReturn(o,r.qty);else{if(129!==o[0].tokenType)throw new Error(`Token Type ${o[0].tokenType} unknown`);l=await e.bchjs.SLP.NFT1.generateNFTGroupSendOpReturn(o,r.qty)}const _=t.from(l.script,"hex");c.addOutput(_,0),c.addOutput(e.bchjs.SLP.Address.toLegacyAddress(r.address),546),l.outputs>1&&c.addOutput(e.bchjs.SLP.Address.toLegacyAddress(i.address),546),c.addOutput(_$bchDonation_159("psf").donations,2e3),f&&f>546&&c.addOutput(i.cashAddress,f);const d=await e.sendBch.getKeyPairFromMnemonic(i);o.forEach((t,e)=>{c.sign(e,d,void 0,c.hashTypes.SIGHASH_ALL,t.value)}),h.forEach((t,e)=>{c.sign(o.length+e,d,void 0,c.hashTypes.SIGHASH_ALL,t.value)});const p=c.build();return{hex:p.toHex(),txid:p.getId()}}catch(err){throw console.error("Error in tokens.js/createTransaction()"),err}}}}).call(this,_$buffer_460({}).Buffer);var _$utxoMocks_395={mockUtxoStore:[{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:1,value:546,satoshis:546,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:1,utxoType:"token",transactionType:"send",tokenId:"a4fb5c2da1aa064e25018a43f9165040071d9e984ba190c222a7f59053af84b2",tokenTicker:"TROUT",tokenName:"Trout's test token",tokenDocumentUrl:"troutsblog.com",tokenDocumentHash:"",decimals:2,tokenType:1,tokenQty:2,isValid:!0},{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:4,value:2960,satoshis:2960,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:4,isValid:!1}],mockBchUtxos:[{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:4,value:2960,satoshis:2960,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:4,isValid:!1}],mockTokenUtxos:[{height:639762,tx_hash:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",tx_pos:1,value:546,satoshis:546,txid:"7fd05098bad5acb6c3ec15723227eeaf0437615a5665e5715cbc4a54a67dfe6b",vout:1,utxoType:"token",transactionType:"send",tokenId:"a4fb5c2da1aa064e25018a43f9165040071d9e984ba190c222a7f59053af84b2",tokenTicker:"TROUT",tokenName:"Trout's test token",tokenDocumentUrl:"troutsblog.com",tokenDocumentHash:"",decimals:2,tokenType:1,tokenQty:1,isValid:!0}]};let ___this_1;var _$minimalSlpWallet_1=class{constructor(t,e){this.advancedOptions=e||{},this.hdPath=this.advancedOptions.hdPath||"m/44'/245'/0'/0/0";const r={};this.advancedOptions.restURL&&(r.restURL=e.restURL),this.advancedOptions.apiToken&&(r.apiToken=e.apiToken),this.fee=1.2,this.advancedOptions.fee&&(this.fee=this.advancedOptions.fee),this.isTest=!1,this.advancedOptions.test&&(this.isTest=!0),this.crypto=_$cryptoJs_236,this.BCHJS=_$bchJs_6,this.bchjs=new _$bchJs_6(r),this.sendBch=new _$sendBch_2(r),this.utxos=new _$utxos_4(r),this.tokens=new _$tokens_3(r),this.temp=[],___this_1=this,this.walletInfoCreated=!1,this.walletInfoPromise=this.create(t)}async create(t){try{t&&this.advancedOptions.password&&(t=this.decrypt(t,this.advancedOptions.password)),t=t||___this_1.bchjs.Mnemonic.generate(128);const e=await ___this_1.bchjs.Mnemonic.toSeed(t),r=___this_1.bchjs.HDNode.fromSeed(e).derivePath(this.hdPath),i=___this_1.bchjs.HDNode.toWIF(r),n=___this_1.bchjs.HDNode.toPublicKey(r),o={};this.advancedOptions.password&&(o.mnemonicEncrypted=this.encrypt(t,this.advancedOptions.password)),o.mnemonic=t,o.privateKey=i,o.publicKey=n.toString("hex"),o.address=o.cashAddress=___this_1.bchjs.HDNode.toCashAddress(r),o.slpAddress=___this_1.bchjs.SLP.Address.toSLPAddress(o.address),o.legacyAddress=___this_1.bchjs.HDNode.toLegacyAddress(r),o.hdPath=___this_1.hdPath,this.isTest?(___this_1.utxos.utxoStore=_$utxoMocks_395.mockUtxoStore,___this_1.utxos.bchUtxos=_$utxoMocks_395.mockBchUtxos,___this_1.utxos.tokenUtxos=_$utxoMocks_395.mockTokenUtxos):await ___this_1.utxos.initUtxoStore(o.address),___this_1.walletInfoCreated=!0,___this_1.walletInfo=o}catch(err){throw console.error("Error in create()"),err}}getUtxos(){return ___this_1.utxos.initUtxoStore()}encrypt(t,e){return this.crypto.AES.encrypt(t,e).toString()}decrypt(t,e){let r;try{r=this.crypto.AES.decrypt(t,e).toString(this.crypto.enc.Utf8)}catch(err){throw new Error("Wrong password")}return r}async getBalance(t){const e=t||this.walletInfo.cashAddress,r=await this.bchjs.Electrumx.balance(e);return r.balance.confirmed+r.balance.unconfirmed}async getTransactions(t){const e=t||this.walletInfo.cashAddress;return(await this.bchjs.Electrumx.transactions(e)).transactions.map(t=>t.tx_hash)}send(t){try{return ___this_1.sendBch.sendBch(t,{mnemonic:___this_1.walletInfo.mnemonic,cashAddress:___this_1.walletInfo.address,hdPath:___this_1.walletInfo.hdPath,fee:___this_1.fee},___this_1.utxos.bchUtxos)}catch(err){throw console.error("Error in send()"),err}}sendTokens(t,e){try{return e||(e=___this_1.fee),___this_1.tokens.sendTokens(t,___this_1.walletInfo,___this_1.utxos.bchUtxos,___this_1.utxos.tokenUtxos,e)}catch(err){throw console.error("Error in send()"),err}}listTokens(t){const e=t||this.walletInfo.slpAddress;return ___this_1.tokens.listTokensFromAddress(e)}sendAll(t){try{return ___this_1.sendBch.sendAllBch(t,{mnemonic:___this_1.walletInfo.mnemonic,cashAddress:___this_1.walletInfo.address,hdPath:___this_1.walletInfo.hdPath,fee:___this_1.fee},___this_1.utxos.bchUtxos)}catch(err){throw console.error("Error in sendAll()"),err}}};return _$minimalSlpWallet_1})); \ No newline at end of file