(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[714],{42474:function(e,t,r){var i=r(48764).Buffer,n=r(34155);!function(){var t,u,b,m,y,g,v,_={7160:function(e,t,r){t.bignum=r(711),t.define=r(495).define,t.base=r(853),t.constants=r(7335),t.decoders=r(6701),t.encoders=r(3418)},495:function(e,t,r){var i=r(7160),n=r(3782);function Entity(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new Entity(e,t)},Entity.prototype._createNamed=function(e){var t;try{t=r(6144).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return n(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},Entity.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i.decoders[e])),this.decoders[e]},Entity.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},Entity.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i.encoders[e])),this.encoders[e]},Entity.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},6483:function(e,t,r){var i=r(3782),n=r(853).Reporter,u=r(4300).Buffer;function DecoderBuffer(e,t){if(n.call(this,t),!u.isBuffer(e)){this.error("Input not Buffer");return}this.base=e,this.offset=0,this.length=e.length}function EncoderBuffer(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof EncoderBuffer||(e=new EncoderBuffer(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=u.byteLength(e);else{if(!u.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}i(DecoderBuffer,n),t.C=DecoderBuffer,DecoderBuffer.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function(e){var t=new DecoderBuffer(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},DecoderBuffer.prototype.isEmpty=function(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new DecoderBuffer(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},DecoderBuffer.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.R=EncoderBuffer,EncoderBuffer.prototype.join=function(e,t){return e||(e=new u(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(r){r.join(e,t),t+=r.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):u.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},853:function(e,t,r){t.Reporter=r(1293).b,t.DecoderBuffer=r(6483).C,t.EncoderBuffer=r(6483).R,t.Node=r(9374)},9374:function(e,t,r){var i=r(853).Reporter,n=r(853).EncoderBuffer,u=r(853).DecoderBuffer,b=r(3523),m=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],y=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(m);function Node(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=Node;var g=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function(){var e=this._baseState,t={};g.forEach(function(r){t[r]=e[r]});var r=new this.constructor(t.parent);return r._baseState=t,r},Node.prototype._wrap=function(){var e=this._baseState;y.forEach(function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}},this)},Node.prototype._init=function(e){var t=this._baseState;b(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),b.equal(t.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function(e){var t=this._baseState,r=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==r.length&&(b(null===t.children),t.children=r,r.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(b(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(r){r==(0|r)&&(r|=0),t[e[r]]=r}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){Node.prototype[e]=function(){throw Error(e+" not implemented for encoding: "+this._baseState.enc)}}),m.forEach(function(e){Node.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return b(null===t.tag),t.tag=e,this._useArgs(r),this}}),Node.prototype.use=function(e){b(e);var t=this._baseState;return b(null===t.use),t.use=e,this},Node.prototype.optional=function(){return this._baseState.optional=!0,this},Node.prototype.def=function(e){var t=this._baseState;return b(null===t.default),t.default=e,t.optional=!0,this},Node.prototype.explicit=function(e){var t=this._baseState;return b(null===t.explicit&&null===t.implicit),t.explicit=e,this},Node.prototype.implicit=function(e){var t=this._baseState;return b(null===t.explicit&&null===t.implicit),t.implicit=e,this},Node.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Node.prototype.key=function(e){var t=this._baseState;return b(null===t.key),t.key=e,this},Node.prototype.any=function(){return this._baseState.any=!0,this},Node.prototype.choice=function(e){var t=this._baseState;return b(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},Node.prototype.contains=function(e){var t=this._baseState;return b(null===t.use),t.contains=e,this},Node.prototype._decode=function(e,t){var r,i=this._baseState;if(null===i.parent)return e.wrapResult(i.children[0]._decode(e,t));var n=i.default,b=!0,m=null;if(null!==i.key&&(m=e.enterKey(i.key)),i.optional){var y=null;if(null!==i.explicit?y=i.explicit:null!==i.implicit?y=i.implicit:null!==i.tag&&(y=i.tag),null!==y||i.any){if(b=this._peekTag(e,y,i.any),e.isError(b))return b}else{var g=e.save();try{null===i.choice?this._decodeGeneric(i.tag,e,t):this._decodeChoice(e,t),b=!0}catch(e){b=!1}e.restore(g)}}if(i.obj&&b&&(r=e.enterObject()),b){if(null!==i.explicit){var v=this._decodeTag(e,i.explicit);if(e.isError(v))return v;e=v}var _=e.offset;if(null===i.use&&null===i.choice){if(i.any)var g=e.save();var w=this._decodeTag(e,null!==i.implicit?i.implicit:i.tag,i.any);if(e.isError(w))return w;i.any?n=e.raw(g):e=w}if(t&&t.track&&null!==i.tag&&t.track(e.path(),_,e.length,"tagged"),t&&t.track&&null!==i.tag&&t.track(e.path(),e.offset,e.length,"content"),i.any||(n=null===i.choice?this._decodeGeneric(i.tag,e,t):this._decodeChoice(e,t)),e.isError(n))return n;if(i.any||null!==i.choice||null===i.children||i.children.forEach(function(r){r._decode(e,t)}),i.contains&&("octstr"===i.tag||"bitstr"===i.tag)){var M=new u(n);n=this._getUse(i.contains,e._reporterState.obj)._decode(M,t)}}return i.obj&&b&&(n=e.leaveObject(r)),null!==i.key&&(null!==n||!0===b)?e.leaveKey(m,i.key,n):null!==m&&e.exitKey(m),n},Node.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;if("seq"===e||"set"===e)return null;if("seqof"===e||"setof"===e)return this._decodeList(t,e,i.args[0],r);if(/str$/.test(e))return this._decodeStr(t,e,r);if("objid"===e&&i.args)return this._decodeObjid(t,i.args[0],i.args[1],r);if("objid"===e)return this._decodeObjid(t,null,null,r);if("gentime"===e||"utctime"===e)return this._decodeTime(t,e,r);if("null_"===e)return this._decodeNull(t,r);if("bool"===e)return this._decodeBool(t,r);else if("objDesc"===e)return this._decodeStr(t,e,r);else if("int"===e||"enum"===e)return this._decodeInt(t,i.args&&i.args[0],r);return null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},Node.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),b(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},Node.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return(Object.keys(r.choice).some(function(u){var b=e.save(),m=r.choice[u];try{var y=m._decode(e,t);if(e.isError(y))return!1;i={type:u,value:y},n=!0}catch(t){return e.restore(b),!1}return!0},this),n)?i:e.error("Choice not matched")},Node.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},Node.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},Node.prototype._encodeValue=function(e,t,r){var n,u=this._baseState;if(null===u.parent)return u.children[0]._encode(e,t||new i);var n=null;if(this.reporter=t,u.optional&&void 0===e){if(null===u.default)return;e=u.default}var b=null,m=!1;if(u.any)n=this._createEncoderBuffer(e);else if(u.choice)n=this._encodeChoice(e,t);else if(u.contains)b=this._getUse(u.contains,r)._encode(e,t),m=!0;else if(u.children)b=u.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n},this).filter(function(e){return e}),b=this._createEncoderBuffer(b);else if("seqof"===u.tag||"setof"===u.tag){if(!(u.args&&1===u.args.length))return t.error("Too many args for : "+u.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var y=this.clone();y._baseState.implicit=null,b=this._createEncoderBuffer(e.map(function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)},y))}else null!==u.use?n=this._getUse(u.use,r)._encode(e,t):(b=this._encodePrimitive(u.tag,e),m=!0);if(!u.any&&null===u.choice){var g=null!==u.implicit?u.implicit:u.tag,v=null===u.implicit?"universal":"context";null===g?null===u.use&&t.error("Tag could be omitted only for .use()"):null===u.use&&(n=this._encodeComposite(g,m,v,b))}return null!==u.explicit&&(n=this._encodeComposite(u.explicit,!1,"context",n)),n},Node.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||b(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},Node.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);else if("objDesc"===e)return this._encodeStr(t,e);else throw Error("Unsupported tag: "+e)},Node.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},Node.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},1293:function(e,t,r){var i=r(3782);function Reporter(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function ReporterError(e,t){this.path=e,this.rethrow(t)}t.b=Reporter,Reporter.prototype.isError=function(e){return e instanceof ReporterError},Reporter.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},Reporter.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},Reporter.prototype.enterKey=function(e){return this._reporterState.path.push(e)},Reporter.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},Reporter.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},Reporter.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},Reporter.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof ReporterError;if(t=i?e:new ReporterError(r.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},Reporter.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(ReporterError,Error),ReporterError.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw Error(this.message)}catch(e){this.stack=e.stack}return this}},9791:function(e,t,r){var i=r(7335);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=i._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=i._reverse(t.tag)},7335:function(e,t,r){t._reverse=function(e){var t={};return Object.keys(e).forEach(function(r){(0|r)==r&&(r|=0),t[e[r]]=r}),t},t.der=r(9791)},2259:function(e,t,r){var i=r(3782),n=r(7160),u=n.base,b=n.bignum,m=n.constants.der;function DERDecoder(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new DERNode,this.tree._init(e.body)}function DERNode(e){u.Node.call(this,"der",e)}function derDecodeTag(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=m.tagClass[r>>6],n=(32&r)==0;if((31&r)==31){var u=r;for(r=0;(128&u)==128;){if(u=e.readUInt8(t),e.isError(u))return u;r<<=7,r|=127&u}}else r&=31;var b=m.tag[r];return{cls:i,primitive:n,tag:r,tagStr:b}}function derDecodeLen(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if((128&i)==0)return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var u=0;u=31?i.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=m.tagClassByName[r||"universal"]<<6)}e.exports=DEREncoder,DEREncoder.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(DERNode,b.Node),DERNode.prototype._encodeComposite=function(e,t,r,i){var u=encodeTag(e,t,r,this.reporter);if(i.length<128){var b=new n(2);return b[0]=u,b[1]=i.length,this._createEncoderBuffer([b,i])}for(var m=1,y=i.length;y>=256;y>>=8)m++;var b=new n(2+m);b[0]=u,b[1]=128|m;for(var y=1+m,g=i.length;g>0;y--,g>>=8)b[y]=255&g;return this._createEncoderBuffer([b,i])},DERNode.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new n(2*e.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var u=0,i=0;i=128;b>>=7)u++}for(var m=new n(u),y=m.length-1,i=e.length-1;i>=0;i--){var b=e[i];for(m[y--]=127&b;(b>>=7)>0;)m[y--]=128|127&b}return this._createEncoderBuffer(m)},DERNode.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[two(i.getFullYear()),two(i.getUTCMonth()+1),two(i.getUTCDate()),two(i.getUTCHours()),two(i.getUTCMinutes()),two(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[two(i.getFullYear()%100),two(i.getUTCMonth()+1),two(i.getUTCDate()),two(i.getUTCHours()),two(i.getUTCMinutes()),two(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},DERNode.prototype._encodeNull=function(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new n(r)}if(n.isBuffer(e)){var i=e.length;0===e.length&&i++;var u=new n(i);return e.copy(u),0===e.length&&(u[0]=0),this._createEncoderBuffer(u)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var i=1,b=e;b>=256;b>>=8)i++;for(var u=Array(i),b=u.length-1;b>=0;b--)u[b]=255&e,e>>=8;return 128&u[0]&&u.unshift(0),this._createEncoderBuffer(new n(u))},DERNode.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},DERNode.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},DERNode.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var u=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),u.length!==n.defaultBuffer.length)return!1;for(i=0;i=49&&b<=54?i|=b-49+10:b>=17&&b<=22?i|=b-17+10:i|=15&b}return i}function parseBase(e,t,r,i){for(var n=0,u=Math.min(e.length,r),b=t;b=49?n+=m-49+10:m>=17?n+=m-17+10:n+=m}return n}BN.isBN=function(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function(e,t){return e.cmp(t)>0?e:t},BN.min=function(e,t){return 0>e.cmp(t)?e:t},BN.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},BN.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(assert(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},BN.prototype._initArray=function(e,t,r){if(assert("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i,n,u=0;u=0;u-=3)n=e[u]|e[u-1]<<8|e[u-2]<<16,this.words[i]|=n<>>26-b&67108863,(b+=24)>=26&&(b-=26,i++);else if("le"===r)for(u=0,i=0;u>>26-b&67108863,(b+=24)>=26&&(b-=26,i++);return this.strip()},BN.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r,i,n=0;n=t;n-=6)i=parseHex(e,n,n+6),this.words[r]|=i<>>26-u&4194303,(u+=24)>=26&&(u-=26,r++);n+6!==t&&(i=parseHex(e,t,n+6),this.words[r]|=i<>>26-u&4194303),this.strip()},BN.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var u=e.length-r,b=u%i,m=Math.min(u,u-b)+r,y=0,g=r;g1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function(){return(this.red?""};var i,n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[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],b=[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 toBitArray(e){for(var t=Array(e.bitLength()),r=0;r>>n}return t}function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],u=0|t.words[0],b=n*u,m=67108863&b,y=b/67108864|0;r.words[0]=m;for(var g=1;g>>26,_=67108863&y,w=Math.min(g,t.length-1),M=Math.max(0,g-e.length+1);M<=w;M++){var S=g-M|0;v+=(b=(n=0|e.words[S])*(u=0|t.words[M])+_)/67108864|0,_=67108863&b}r.words[g]=0|_,y=0|v}return 0!==y?r.words[g]=0|y:r.length--,r.strip()}BN.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var r,i=0,m=0,y=0;y>>24-i&16777215)||y!==this.length-1?n[6-v.length]+v+r:v+r,(i+=2)>=26&&(i-=26,y--)}for(0!==m&&(r=m.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var _=u[e],w=b[e];r="";var M=this.clone();for(M.negative=0;!M.isZero();){var S=M.modn(w).toString(e);r=(M=M.idivn(w)).isZero()?S+r:n[_-S.length]+S+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function(){return this.toString(16)},BN.prototype.toBuffer=function(e,t){return assert(void 0!==i),this.toArrayLike(i,e,t)},BN.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function(e,t,r){var i,n,u=this.byteLength(),b=r||Math.max(1,u);assert(u<=b,"byte array longer than desired length"),assert(b>0,"Requested array length <= 0"),this.strip();var m=new e(b),y=this.clone();if("le"===t){for(n=0;!y.isZero();n++)i=y.andln(255),y.iushrn(8),m[n]=i;for(;n=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},BN.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},BN.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},BN.prototype.notn=function(e){return this.clone().inotn(e)},BN.prototype.setn=function(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<e.length?(r=this,i=e):(r=e,i=this);for(var t,r,i,n=0,u=0;u>>26;for(;0!==n&&u>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ue.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var u=0,b=0;b>26,this.words[b]=67108863&i;for(;0!==u&&b>26,this.words[b]=67108863&i;if(0===u&&b>>13,M=0|b[1],S=8191&M,B=M>>>13,E=0|b[2],k=8191&E,A=E>>>13,N=0|b[3],R=8191&N,P=N>>>13,x=0|b[4],I=8191&x,C=x>>>13,D=0|b[5],T=8191&D,j=D>>>13,O=0|b[6],H=8191&O,q=O>>>13,L=0|b[7],z=8191&L,U=L>>>13,F=0|b[8],W=8191&F,V=F>>>13,G=0|b[9],Z=8191&G,J=G>>>13,X=0|m[0],Y=8191&X,$=X>>>13,Q=0|m[1],ee=8191&Q,et=Q>>>13,er=0|m[2],ei=8191&er,en=er>>>13,ea=0|m[3],eo=8191&ea,es=ea>>>13,ef=0|m[4],eh=8191&ef,ed=ef>>>13,ec=0|m[5],eu=8191&ec,el=ec>>>13,ep=0|m[6],eb=8191&ep,em=ep>>>13,ey=0|m[7],eg=8191&ey,ev=ey>>>13,e_=0|m[8],ew=8191&e_,eM=e_>>>13,eS=0|m[9],eB=8191&eS,eE=eS>>>13;r.negative=e.negative^t.negative,r.length=19;var ek=(g+(i=Math.imul(_,Y))|0)+((8191&(n=(n=Math.imul(_,$))+Math.imul(w,Y)|0))<<13)|0;g=((u=Math.imul(w,$))+(n>>>13)|0)+(ek>>>26)|0,ek&=67108863,i=Math.imul(S,Y),n=(n=Math.imul(S,$))+Math.imul(B,Y)|0,u=Math.imul(B,$);var eA=(g+(i=i+Math.imul(_,ee)|0)|0)+((8191&(n=(n=n+Math.imul(_,et)|0)+Math.imul(w,ee)|0))<<13)|0;g=((u=u+Math.imul(w,et)|0)+(n>>>13)|0)+(eA>>>26)|0,eA&=67108863,i=Math.imul(k,Y),n=(n=Math.imul(k,$))+Math.imul(A,Y)|0,u=Math.imul(A,$),i=i+Math.imul(S,ee)|0,n=(n=n+Math.imul(S,et)|0)+Math.imul(B,ee)|0,u=u+Math.imul(B,et)|0;var eN=(g+(i=i+Math.imul(_,ei)|0)|0)+((8191&(n=(n=n+Math.imul(_,en)|0)+Math.imul(w,ei)|0))<<13)|0;g=((u=u+Math.imul(w,en)|0)+(n>>>13)|0)+(eN>>>26)|0,eN&=67108863,i=Math.imul(R,Y),n=(n=Math.imul(R,$))+Math.imul(P,Y)|0,u=Math.imul(P,$),i=i+Math.imul(k,ee)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(A,ee)|0,u=u+Math.imul(A,et)|0,i=i+Math.imul(S,ei)|0,n=(n=n+Math.imul(S,en)|0)+Math.imul(B,ei)|0,u=u+Math.imul(B,en)|0;var eR=(g+(i=i+Math.imul(_,eo)|0)|0)+((8191&(n=(n=n+Math.imul(_,es)|0)+Math.imul(w,eo)|0))<<13)|0;g=((u=u+Math.imul(w,es)|0)+(n>>>13)|0)+(eR>>>26)|0,eR&=67108863,i=Math.imul(I,Y),n=(n=Math.imul(I,$))+Math.imul(C,Y)|0,u=Math.imul(C,$),i=i+Math.imul(R,ee)|0,n=(n=n+Math.imul(R,et)|0)+Math.imul(P,ee)|0,u=u+Math.imul(P,et)|0,i=i+Math.imul(k,ei)|0,n=(n=n+Math.imul(k,en)|0)+Math.imul(A,ei)|0,u=u+Math.imul(A,en)|0,i=i+Math.imul(S,eo)|0,n=(n=n+Math.imul(S,es)|0)+Math.imul(B,eo)|0,u=u+Math.imul(B,es)|0;var eP=(g+(i=i+Math.imul(_,eh)|0)|0)+((8191&(n=(n=n+Math.imul(_,ed)|0)+Math.imul(w,eh)|0))<<13)|0;g=((u=u+Math.imul(w,ed)|0)+(n>>>13)|0)+(eP>>>26)|0,eP&=67108863,i=Math.imul(T,Y),n=(n=Math.imul(T,$))+Math.imul(j,Y)|0,u=Math.imul(j,$),i=i+Math.imul(I,ee)|0,n=(n=n+Math.imul(I,et)|0)+Math.imul(C,ee)|0,u=u+Math.imul(C,et)|0,i=i+Math.imul(R,ei)|0,n=(n=n+Math.imul(R,en)|0)+Math.imul(P,ei)|0,u=u+Math.imul(P,en)|0,i=i+Math.imul(k,eo)|0,n=(n=n+Math.imul(k,es)|0)+Math.imul(A,eo)|0,u=u+Math.imul(A,es)|0,i=i+Math.imul(S,eh)|0,n=(n=n+Math.imul(S,ed)|0)+Math.imul(B,eh)|0,u=u+Math.imul(B,ed)|0;var ex=(g+(i=i+Math.imul(_,eu)|0)|0)+((8191&(n=(n=n+Math.imul(_,el)|0)+Math.imul(w,eu)|0))<<13)|0;g=((u=u+Math.imul(w,el)|0)+(n>>>13)|0)+(ex>>>26)|0,ex&=67108863,i=Math.imul(H,Y),n=(n=Math.imul(H,$))+Math.imul(q,Y)|0,u=Math.imul(q,$),i=i+Math.imul(T,ee)|0,n=(n=n+Math.imul(T,et)|0)+Math.imul(j,ee)|0,u=u+Math.imul(j,et)|0,i=i+Math.imul(I,ei)|0,n=(n=n+Math.imul(I,en)|0)+Math.imul(C,ei)|0,u=u+Math.imul(C,en)|0,i=i+Math.imul(R,eo)|0,n=(n=n+Math.imul(R,es)|0)+Math.imul(P,eo)|0,u=u+Math.imul(P,es)|0,i=i+Math.imul(k,eh)|0,n=(n=n+Math.imul(k,ed)|0)+Math.imul(A,eh)|0,u=u+Math.imul(A,ed)|0,i=i+Math.imul(S,eu)|0,n=(n=n+Math.imul(S,el)|0)+Math.imul(B,eu)|0,u=u+Math.imul(B,el)|0;var eI=(g+(i=i+Math.imul(_,eb)|0)|0)+((8191&(n=(n=n+Math.imul(_,em)|0)+Math.imul(w,eb)|0))<<13)|0;g=((u=u+Math.imul(w,em)|0)+(n>>>13)|0)+(eI>>>26)|0,eI&=67108863,i=Math.imul(z,Y),n=(n=Math.imul(z,$))+Math.imul(U,Y)|0,u=Math.imul(U,$),i=i+Math.imul(H,ee)|0,n=(n=n+Math.imul(H,et)|0)+Math.imul(q,ee)|0,u=u+Math.imul(q,et)|0,i=i+Math.imul(T,ei)|0,n=(n=n+Math.imul(T,en)|0)+Math.imul(j,ei)|0,u=u+Math.imul(j,en)|0,i=i+Math.imul(I,eo)|0,n=(n=n+Math.imul(I,es)|0)+Math.imul(C,eo)|0,u=u+Math.imul(C,es)|0,i=i+Math.imul(R,eh)|0,n=(n=n+Math.imul(R,ed)|0)+Math.imul(P,eh)|0,u=u+Math.imul(P,ed)|0,i=i+Math.imul(k,eu)|0,n=(n=n+Math.imul(k,el)|0)+Math.imul(A,eu)|0,u=u+Math.imul(A,el)|0,i=i+Math.imul(S,eb)|0,n=(n=n+Math.imul(S,em)|0)+Math.imul(B,eb)|0,u=u+Math.imul(B,em)|0;var eC=(g+(i=i+Math.imul(_,eg)|0)|0)+((8191&(n=(n=n+Math.imul(_,ev)|0)+Math.imul(w,eg)|0))<<13)|0;g=((u=u+Math.imul(w,ev)|0)+(n>>>13)|0)+(eC>>>26)|0,eC&=67108863,i=Math.imul(W,Y),n=(n=Math.imul(W,$))+Math.imul(V,Y)|0,u=Math.imul(V,$),i=i+Math.imul(z,ee)|0,n=(n=n+Math.imul(z,et)|0)+Math.imul(U,ee)|0,u=u+Math.imul(U,et)|0,i=i+Math.imul(H,ei)|0,n=(n=n+Math.imul(H,en)|0)+Math.imul(q,ei)|0,u=u+Math.imul(q,en)|0,i=i+Math.imul(T,eo)|0,n=(n=n+Math.imul(T,es)|0)+Math.imul(j,eo)|0,u=u+Math.imul(j,es)|0,i=i+Math.imul(I,eh)|0,n=(n=n+Math.imul(I,ed)|0)+Math.imul(C,eh)|0,u=u+Math.imul(C,ed)|0,i=i+Math.imul(R,eu)|0,n=(n=n+Math.imul(R,el)|0)+Math.imul(P,eu)|0,u=u+Math.imul(P,el)|0,i=i+Math.imul(k,eb)|0,n=(n=n+Math.imul(k,em)|0)+Math.imul(A,eb)|0,u=u+Math.imul(A,em)|0,i=i+Math.imul(S,eg)|0,n=(n=n+Math.imul(S,ev)|0)+Math.imul(B,eg)|0,u=u+Math.imul(B,ev)|0;var eD=(g+(i=i+Math.imul(_,ew)|0)|0)+((8191&(n=(n=n+Math.imul(_,eM)|0)+Math.imul(w,ew)|0))<<13)|0;g=((u=u+Math.imul(w,eM)|0)+(n>>>13)|0)+(eD>>>26)|0,eD&=67108863,i=Math.imul(Z,Y),n=(n=Math.imul(Z,$))+Math.imul(J,Y)|0,u=Math.imul(J,$),i=i+Math.imul(W,ee)|0,n=(n=n+Math.imul(W,et)|0)+Math.imul(V,ee)|0,u=u+Math.imul(V,et)|0,i=i+Math.imul(z,ei)|0,n=(n=n+Math.imul(z,en)|0)+Math.imul(U,ei)|0,u=u+Math.imul(U,en)|0,i=i+Math.imul(H,eo)|0,n=(n=n+Math.imul(H,es)|0)+Math.imul(q,eo)|0,u=u+Math.imul(q,es)|0,i=i+Math.imul(T,eh)|0,n=(n=n+Math.imul(T,ed)|0)+Math.imul(j,eh)|0,u=u+Math.imul(j,ed)|0,i=i+Math.imul(I,eu)|0,n=(n=n+Math.imul(I,el)|0)+Math.imul(C,eu)|0,u=u+Math.imul(C,el)|0,i=i+Math.imul(R,eb)|0,n=(n=n+Math.imul(R,em)|0)+Math.imul(P,eb)|0,u=u+Math.imul(P,em)|0,i=i+Math.imul(k,eg)|0,n=(n=n+Math.imul(k,ev)|0)+Math.imul(A,eg)|0,u=u+Math.imul(A,ev)|0,i=i+Math.imul(S,ew)|0,n=(n=n+Math.imul(S,eM)|0)+Math.imul(B,ew)|0,u=u+Math.imul(B,eM)|0;var eT=(g+(i=i+Math.imul(_,eB)|0)|0)+((8191&(n=(n=n+Math.imul(_,eE)|0)+Math.imul(w,eB)|0))<<13)|0;g=((u=u+Math.imul(w,eE)|0)+(n>>>13)|0)+(eT>>>26)|0,eT&=67108863,i=Math.imul(Z,ee),n=(n=Math.imul(Z,et))+Math.imul(J,ee)|0,u=Math.imul(J,et),i=i+Math.imul(W,ei)|0,n=(n=n+Math.imul(W,en)|0)+Math.imul(V,ei)|0,u=u+Math.imul(V,en)|0,i=i+Math.imul(z,eo)|0,n=(n=n+Math.imul(z,es)|0)+Math.imul(U,eo)|0,u=u+Math.imul(U,es)|0,i=i+Math.imul(H,eh)|0,n=(n=n+Math.imul(H,ed)|0)+Math.imul(q,eh)|0,u=u+Math.imul(q,ed)|0,i=i+Math.imul(T,eu)|0,n=(n=n+Math.imul(T,el)|0)+Math.imul(j,eu)|0,u=u+Math.imul(j,el)|0,i=i+Math.imul(I,eb)|0,n=(n=n+Math.imul(I,em)|0)+Math.imul(C,eb)|0,u=u+Math.imul(C,em)|0,i=i+Math.imul(R,eg)|0,n=(n=n+Math.imul(R,ev)|0)+Math.imul(P,eg)|0,u=u+Math.imul(P,ev)|0,i=i+Math.imul(k,ew)|0,n=(n=n+Math.imul(k,eM)|0)+Math.imul(A,ew)|0,u=u+Math.imul(A,eM)|0;var ej=(g+(i=i+Math.imul(S,eB)|0)|0)+((8191&(n=(n=n+Math.imul(S,eE)|0)+Math.imul(B,eB)|0))<<13)|0;g=((u=u+Math.imul(B,eE)|0)+(n>>>13)|0)+(ej>>>26)|0,ej&=67108863,i=Math.imul(Z,ei),n=(n=Math.imul(Z,en))+Math.imul(J,ei)|0,u=Math.imul(J,en),i=i+Math.imul(W,eo)|0,n=(n=n+Math.imul(W,es)|0)+Math.imul(V,eo)|0,u=u+Math.imul(V,es)|0,i=i+Math.imul(z,eh)|0,n=(n=n+Math.imul(z,ed)|0)+Math.imul(U,eh)|0,u=u+Math.imul(U,ed)|0,i=i+Math.imul(H,eu)|0,n=(n=n+Math.imul(H,el)|0)+Math.imul(q,eu)|0,u=u+Math.imul(q,el)|0,i=i+Math.imul(T,eb)|0,n=(n=n+Math.imul(T,em)|0)+Math.imul(j,eb)|0,u=u+Math.imul(j,em)|0,i=i+Math.imul(I,eg)|0,n=(n=n+Math.imul(I,ev)|0)+Math.imul(C,eg)|0,u=u+Math.imul(C,ev)|0,i=i+Math.imul(R,ew)|0,n=(n=n+Math.imul(R,eM)|0)+Math.imul(P,ew)|0,u=u+Math.imul(P,eM)|0;var eO=(g+(i=i+Math.imul(k,eB)|0)|0)+((8191&(n=(n=n+Math.imul(k,eE)|0)+Math.imul(A,eB)|0))<<13)|0;g=((u=u+Math.imul(A,eE)|0)+(n>>>13)|0)+(eO>>>26)|0,eO&=67108863,i=Math.imul(Z,eo),n=(n=Math.imul(Z,es))+Math.imul(J,eo)|0,u=Math.imul(J,es),i=i+Math.imul(W,eh)|0,n=(n=n+Math.imul(W,ed)|0)+Math.imul(V,eh)|0,u=u+Math.imul(V,ed)|0,i=i+Math.imul(z,eu)|0,n=(n=n+Math.imul(z,el)|0)+Math.imul(U,eu)|0,u=u+Math.imul(U,el)|0,i=i+Math.imul(H,eb)|0,n=(n=n+Math.imul(H,em)|0)+Math.imul(q,eb)|0,u=u+Math.imul(q,em)|0,i=i+Math.imul(T,eg)|0,n=(n=n+Math.imul(T,ev)|0)+Math.imul(j,eg)|0,u=u+Math.imul(j,ev)|0,i=i+Math.imul(I,ew)|0,n=(n=n+Math.imul(I,eM)|0)+Math.imul(C,ew)|0,u=u+Math.imul(C,eM)|0;var eH=(g+(i=i+Math.imul(R,eB)|0)|0)+((8191&(n=(n=n+Math.imul(R,eE)|0)+Math.imul(P,eB)|0))<<13)|0;g=((u=u+Math.imul(P,eE)|0)+(n>>>13)|0)+(eH>>>26)|0,eH&=67108863,i=Math.imul(Z,eh),n=(n=Math.imul(Z,ed))+Math.imul(J,eh)|0,u=Math.imul(J,ed),i=i+Math.imul(W,eu)|0,n=(n=n+Math.imul(W,el)|0)+Math.imul(V,eu)|0,u=u+Math.imul(V,el)|0,i=i+Math.imul(z,eb)|0,n=(n=n+Math.imul(z,em)|0)+Math.imul(U,eb)|0,u=u+Math.imul(U,em)|0,i=i+Math.imul(H,eg)|0,n=(n=n+Math.imul(H,ev)|0)+Math.imul(q,eg)|0,u=u+Math.imul(q,ev)|0,i=i+Math.imul(T,ew)|0,n=(n=n+Math.imul(T,eM)|0)+Math.imul(j,ew)|0,u=u+Math.imul(j,eM)|0;var eq=(g+(i=i+Math.imul(I,eB)|0)|0)+((8191&(n=(n=n+Math.imul(I,eE)|0)+Math.imul(C,eB)|0))<<13)|0;g=((u=u+Math.imul(C,eE)|0)+(n>>>13)|0)+(eq>>>26)|0,eq&=67108863,i=Math.imul(Z,eu),n=(n=Math.imul(Z,el))+Math.imul(J,eu)|0,u=Math.imul(J,el),i=i+Math.imul(W,eb)|0,n=(n=n+Math.imul(W,em)|0)+Math.imul(V,eb)|0,u=u+Math.imul(V,em)|0,i=i+Math.imul(z,eg)|0,n=(n=n+Math.imul(z,ev)|0)+Math.imul(U,eg)|0,u=u+Math.imul(U,ev)|0,i=i+Math.imul(H,ew)|0,n=(n=n+Math.imul(H,eM)|0)+Math.imul(q,ew)|0,u=u+Math.imul(q,eM)|0;var eL=(g+(i=i+Math.imul(T,eB)|0)|0)+((8191&(n=(n=n+Math.imul(T,eE)|0)+Math.imul(j,eB)|0))<<13)|0;g=((u=u+Math.imul(j,eE)|0)+(n>>>13)|0)+(eL>>>26)|0,eL&=67108863,i=Math.imul(Z,eb),n=(n=Math.imul(Z,em))+Math.imul(J,eb)|0,u=Math.imul(J,em),i=i+Math.imul(W,eg)|0,n=(n=n+Math.imul(W,ev)|0)+Math.imul(V,eg)|0,u=u+Math.imul(V,ev)|0,i=i+Math.imul(z,ew)|0,n=(n=n+Math.imul(z,eM)|0)+Math.imul(U,ew)|0,u=u+Math.imul(U,eM)|0;var ez=(g+(i=i+Math.imul(H,eB)|0)|0)+((8191&(n=(n=n+Math.imul(H,eE)|0)+Math.imul(q,eB)|0))<<13)|0;g=((u=u+Math.imul(q,eE)|0)+(n>>>13)|0)+(ez>>>26)|0,ez&=67108863,i=Math.imul(Z,eg),n=(n=Math.imul(Z,ev))+Math.imul(J,eg)|0,u=Math.imul(J,ev),i=i+Math.imul(W,ew)|0,n=(n=n+Math.imul(W,eM)|0)+Math.imul(V,ew)|0,u=u+Math.imul(V,eM)|0;var eK=(g+(i=i+Math.imul(z,eB)|0)|0)+((8191&(n=(n=n+Math.imul(z,eE)|0)+Math.imul(U,eB)|0))<<13)|0;g=((u=u+Math.imul(U,eE)|0)+(n>>>13)|0)+(eK>>>26)|0,eK&=67108863,i=Math.imul(Z,ew),n=(n=Math.imul(Z,eM))+Math.imul(J,ew)|0,u=Math.imul(J,eM);var eU=(g+(i=i+Math.imul(W,eB)|0)|0)+((8191&(n=(n=n+Math.imul(W,eE)|0)+Math.imul(V,eB)|0))<<13)|0;g=((u=u+Math.imul(V,eE)|0)+(n>>>13)|0)+(eU>>>26)|0,eU&=67108863;var eF=(g+(i=Math.imul(Z,eB))|0)+((8191&(n=(n=Math.imul(Z,eE))+Math.imul(J,eB)|0))<<13)|0;return g=((u=Math.imul(J,eE))+(n>>>13)|0)+(eF>>>26)|0,eF&=67108863,y[0]=ek,y[1]=eA,y[2]=eN,y[3]=eR,y[4]=eP,y[5]=ex,y[6]=eI,y[7]=eC,y[8]=eD,y[9]=eT,y[10]=ej,y[11]=eO,y[12]=eH,y[13]=eq,y[14]=eL,y[15]=ez,y[16]=eK,y[17]=eU,y[18]=eF,0!==g&&(y[19]=g,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,u=0;u>>26)|0)>>>26,b&=67108863}r.words[u]=m,i=b,b=n}return 0!==i?r.words[u]=i:r.length--,r.strip()}function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(o=smallMulTo),BN.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function(e){for(var t=Array(e),r=BN.prototype._countBits(e)-1,i=0;i>=1;return i},FFTM.prototype.permute=function(e,t,r,i,n,u){for(var b=0;b>>=1)n++;return 1<>>=13,r[2*u+1]=8191&n,n>>>=13;for(u=2*t;u>=26,t+=(i/67108864|0)+(n>>>26),this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function(e){return this.clone().imuln(e)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(e){var t=toBitArray(e);if(0===t.length)return new BN(1);for(var r=this,i=0;i=0);var t,r=e%26,i=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var u=0;for(t=0;t>>26-r}u&&(this.words[t]=u,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,n=e%26,u=Math.min((e-n)/26,this.length),b=67108863^67108863>>>n<u)for(this.length-=u,m=0;m=0&&(0!==y||m>=i);m--){var g=0|this.words[m];this.words[m]=y<<26-n|g>>>n,y=g&b}return r&&0!==y&&(r.words[r.length++]=y),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function(e){return this.clone().ishln(e)},BN.prototype.ushln=function(e){return this.clone().iushln(e)},BN.prototype.shrn=function(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function(e){return this.clone().iushrn(e)},BN.prototype.testn=function(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(m/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===b)return this.strip();for(assert(-1===b),b=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function(e,t){var r,i=this.length-e.length,n=this.clone(),u=e,b=0|u.words[u.length-1];0!=(i=26-this._countBits(b))&&(u=u.ushln(i),n.iushln(i),b=0|u.words[u.length-1]);var m=n.length-u.length;if("mod"!==t){(r=new BN(null)).length=m+1,r.words=Array(r.length);for(var y=0;y=0;v--){var _=(0|n.words[u.length+v])*67108864+(0|n.words[u.length+v-1]);for(_=Math.min(_/b|0,67108863),n._ishlnsubmul(u,_,v);0!==n.negative;)_--,n.negative=0,n._ishlnsubmul(u,1,v),n.isZero()||(n.negative^=1);r&&(r.words[v]=_)}return r&&r.strip(),n.strip(),"div"!==t&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},BN.prototype.divmod=function(e,t,r){var i,n,u;return(assert(!e.isZero()),this.isZero())?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(u=this.neg().divmod(e,t),"mod"!==t&&(i=u.div.neg()),"div"!==t&&(n=u.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:i,mod:n}):0===this.negative&&0!==e.negative?(u=this.divmod(e.neg(),t),"mod"!==t&&(i=u.div.neg()),{div:i,mod:u.mod}):(this.negative&e.negative)!=0?(u=this.neg().divmod(e.neg(),t),"div"!==t&&(n=u.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:u.div,mod:n}):e.length>this.length||0>this.cmp(e)?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t)},BN.prototype.div=function(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),u=r.cmp(i);return u<0||1===n&&0===u?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function(e){assert(e<=67108863);for(var t=67108864%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},BN.prototype.idivn=function(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},BN.prototype.divn=function(e){return this.clone().idivn(e)},BN.prototype.egcd=function(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new BN(1),n=new BN(0),u=new BN(0),b=new BN(1),m=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++m;for(var y=r.clone(),g=t.clone();!t.isZero();){for(var v=0,_=1;(t.words[0]&_)==0&&v<26;++v,_<<=1);if(v>0)for(t.iushrn(v);v-- >0;)(i.isOdd()||n.isOdd())&&(i.iadd(y),n.isub(g)),i.iushrn(1),n.iushrn(1);for(var w=0,M=1;(r.words[0]&M)==0&&w<26;++w,M<<=1);if(w>0)for(r.iushrn(w);w-- >0;)(u.isOdd()||b.isOdd())&&(u.iadd(y),b.isub(g)),u.iushrn(1),b.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(u),n.isub(b)):(r.isub(t),u.isub(i),b.isub(n))}return{a:u,b:b,gcd:r.iushln(m)}},BN.prototype._invmp=function(e){assert(0===e.negative),assert(!e.isZero());var t,r=this,i=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var n=new BN(1),u=new BN(0),b=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var m=0,y=1;(r.words[0]&y)==0&&m<26;++m,y<<=1);if(m>0)for(r.iushrn(m);m-- >0;)n.isOdd()&&n.iadd(b),n.iushrn(1);for(var g=0,v=1;(i.words[0]&v)==0&&g<26;++g,v<<=1);if(g>0)for(i.iushrn(g);g-- >0;)u.isOdd()&&u.iadd(b),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(u)):(i.isub(r),u.isub(n))}return 0>(t=0===r.cmpn(1)?n:u).cmpn(0)&&t.iadd(e),t},BN.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var u=t;t=r,r=u}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},BN.prototype.invm=function(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function(){return(1&this.words[0])==0},BN.prototype.isOdd=function(){return(1&this.words[0])==1},BN.prototype.andln=function(e){return this.words[0]&e},BN.prototype.bincn=function(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,b&=67108863,this.words[u]=b}return 0!==n&&(this.words[u]=n,this.length++),this},BN.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){in&&(t=1);break}}return t},BN.prototype.gtn=function(e){return 1===this.cmpn(e)},BN.prototype.gt=function(e){return 1===this.cmp(e)},BN.prototype.gten=function(e){return this.cmpn(e)>=0},BN.prototype.gte=function(e){return this.cmp(e)>=0},BN.prototype.ltn=function(e){return -1===this.cmpn(e)},BN.prototype.lt=function(e){return -1===this.cmp(e)},BN.prototype.lten=function(e){return 0>=this.cmpn(e)},BN.prototype.lte=function(e){return 0>=this.cmp(e)},BN.prototype.eqn=function(e){return 0===this.cmpn(e)},BN.prototype.eq=function(e){return 0===this.cmp(e)},BN.red=function(e){return new Red(e)},BN.prototype.toRed=function(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(e){return this.red=e,this},BN.prototype.forceRed=function(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function(){var e=new BN(null);return e.words=Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var i=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i>>22,n=u}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function(e){var t;if(m[e])return m[e];if("k256"===e)t=new K256;else if("p224"===e)t=new P224;else if("p192"===e)t=new P192;else if("p25519"===e)t=new P25519;else throw Error("Unknown prime "+e);return m[e]=t,t},Red.prototype._verify1=function(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function(e,t){assert((e.negative|t.negative)==0,"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},Red.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function(e){return this.imul(e,e.clone())},Red.prototype.sqr=function(e){return this.mul(e,e)},Red.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),n=0;!i.isZero()&&0===i.andln(1);)n++,i.iushrn(1);assert(!i.isZero());var u=new BN(1).toRed(this),b=u.redNeg(),m=this.m.subn(1).iushrn(1),y=this.m.bitLength();for(y=new BN(2*y*y).toRed(this);0!==this.pow(y,m).cmp(b);)y.redIAdd(b);for(var g=this.pow(y,i),v=this.pow(e,i.addn(1).iushrn(1)),_=this.pow(e,i),w=n;0!==_.cmp(u);){for(var M=_,S=0;0!==M.cmp(u);S++)M=M.redSqr();assert(S=0;i--){for(var y=t.words[i],g=m-1;g>=0;g--){var v=y>>g&1;if(n!==r[0]&&(n=this.sqr(n)),0===v&&0===u){b=0;continue}u<<=1,u|=v,(4==++b||0===i&&0===g)&&(n=this.mul(n,r[u]),b=0,u=0)}m=26}return n},Red.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},BN.mont=function(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),u=n;return n.cmp(this.m)>=0?u=n.isub(this.m):0>n.cmpn(0)&&(u=n.iadd(this.m)),u._forceRed(this)},Mont.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),u=n;return n.cmp(this.m)>=0?u=n.isub(this.m):0>n.cmpn(0)&&(u=n.iadd(this.m)),u._forceRed(this)},Mont.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},1670:function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{i=r(4300).Buffer}catch(e){}function parseHex(e,t,r){for(var i=0,n=Math.min(e.length,r),u=0,b=t;b=49&&y<=54?y-49+10:y>=17&&y<=22?y-17+10:y,u|=m}return assert(!(240&u),"Invalid character in "+e),i}function parseBase(e,t,r,i){for(var n=0,u=0,b=Math.min(e.length,r),m=t;m=49?y-49+10:y>=17?y-17+10:y,assert(y>=0&&u"}BN.isBN=function(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function(e,t){return e.cmp(t)>0?e:t},BN.min=function(e,t){return 0>e.cmp(t)?e:t},BN.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),t,r)},BN.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(assert(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},BN.prototype._initArray=function(e,t,r){if(assert("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i,n,u=0;u=0;u-=3)n=e[u]|e[u-1]<<8|e[u-2]<<16,this.words[i]|=n<>>26-b&67108863,(b+=24)>=26&&(b-=26,i++);else if("le"===r)for(u=0,i=0;u>>26-b&67108863,(b+=24)>=26&&(b-=26,i++);return this._strip()},BN.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r,i,n=0;n=t;n-=6)i=parseHex(e,n,n+6),this.words[r]|=i<>>26-u&4194303,(u+=24)>=26&&(u-=26,r++);n+6!==t&&(i=parseHex(e,t,n+6),this.words[r]|=i<>>26-u&4194303),this._strip()},BN.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var u=e.length-r,b=u%i,m=Math.min(u,u-b)+r,y=0,g=r;g1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect:BN.prototype.inspect=inspect;var i,n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[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],b=[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 toBitArray(e){for(var t=Array(e.bitLength()),r=0;r>>n&1}return t}function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],u=0|t.words[0],b=n*u,m=67108863&b,y=b/67108864|0;r.words[0]=m;for(var g=1;g>>26,_=67108863&y,w=Math.min(g,t.length-1),M=Math.max(0,g-e.length+1);M<=w;M++){var S=g-M|0;v+=(b=(n=0|e.words[S])*(u=0|t.words[M])+_)/67108864|0,_=67108863&b}r.words[g]=0|_,y=0|v}return 0!==y?r.words[g]=0|y:r.length--,r._strip()}BN.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var r,i=0,m=0,y=0;y>>24-i&16777215)||y!==this.length-1?n[6-v.length]+v+r:v+r,(i+=2)>=26&&(i-=26,y--)}for(0!==m&&(r=m.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var _=u[e],w=b[e];r="";var M=this.clone();for(M.negative=0;!M.isZero();){var S=M.modrn(w).toString(e);r=(M=M.idivn(w)).isZero()?S+r:n[_-S.length]+S+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function(){return this.toString(16,2)},i&&(BN.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),BN.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),n=r||Math.max(1,i);assert(i<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var u=e.allocUnsafe?e.allocUnsafe(n):new e(n);return this["_toArrayLike"+("le"===t?"LE":"BE")](u,i),u},BN.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,u=0;n>8&255),r>16&255),6===u?(r>24&255),i=0,u=0):(i=b>>>24,u+=2)}if(r=0&&(e[r--]=b>>8&255),r>=0&&(e[r--]=b>>16&255),6===u?(r>=0&&(e[r--]=b>>24&255),i=0,u=0):(i=b>>>24,u+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},BN.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},BN.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},BN.prototype.notn=function(e){return this.clone().inotn(e)},BN.prototype.setn=function(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<e.length?(r=this,i=e):(r=e,i=this);for(var t,r,i,n=0,u=0;u>>26;for(;0!==n&&u>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ue.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var u=0,b=0;b>26,this.words[b]=67108863&i;for(;0!==u&&b>26,this.words[b]=67108863&i;if(0===u&&b>>13,M=0|b[1],S=8191&M,B=M>>>13,E=0|b[2],k=8191&E,A=E>>>13,N=0|b[3],R=8191&N,P=N>>>13,x=0|b[4],I=8191&x,C=x>>>13,D=0|b[5],T=8191&D,j=D>>>13,O=0|b[6],H=8191&O,q=O>>>13,L=0|b[7],z=8191&L,U=L>>>13,F=0|b[8],W=8191&F,V=F>>>13,G=0|b[9],Z=8191&G,J=G>>>13,X=0|m[0],Y=8191&X,$=X>>>13,Q=0|m[1],ee=8191&Q,et=Q>>>13,er=0|m[2],ei=8191&er,en=er>>>13,ea=0|m[3],eo=8191&ea,es=ea>>>13,ef=0|m[4],eh=8191&ef,ed=ef>>>13,ec=0|m[5],eu=8191&ec,el=ec>>>13,ep=0|m[6],eb=8191&ep,em=ep>>>13,ey=0|m[7],eg=8191&ey,ev=ey>>>13,e_=0|m[8],ew=8191&e_,eM=e_>>>13,eS=0|m[9],eB=8191&eS,eE=eS>>>13;r.negative=e.negative^t.negative,r.length=19;var ek=(g+(i=Math.imul(_,Y))|0)+((8191&(n=(n=Math.imul(_,$))+Math.imul(w,Y)|0))<<13)|0;g=((u=Math.imul(w,$))+(n>>>13)|0)+(ek>>>26)|0,ek&=67108863,i=Math.imul(S,Y),n=(n=Math.imul(S,$))+Math.imul(B,Y)|0,u=Math.imul(B,$);var eA=(g+(i=i+Math.imul(_,ee)|0)|0)+((8191&(n=(n=n+Math.imul(_,et)|0)+Math.imul(w,ee)|0))<<13)|0;g=((u=u+Math.imul(w,et)|0)+(n>>>13)|0)+(eA>>>26)|0,eA&=67108863,i=Math.imul(k,Y),n=(n=Math.imul(k,$))+Math.imul(A,Y)|0,u=Math.imul(A,$),i=i+Math.imul(S,ee)|0,n=(n=n+Math.imul(S,et)|0)+Math.imul(B,ee)|0,u=u+Math.imul(B,et)|0;var eN=(g+(i=i+Math.imul(_,ei)|0)|0)+((8191&(n=(n=n+Math.imul(_,en)|0)+Math.imul(w,ei)|0))<<13)|0;g=((u=u+Math.imul(w,en)|0)+(n>>>13)|0)+(eN>>>26)|0,eN&=67108863,i=Math.imul(R,Y),n=(n=Math.imul(R,$))+Math.imul(P,Y)|0,u=Math.imul(P,$),i=i+Math.imul(k,ee)|0,n=(n=n+Math.imul(k,et)|0)+Math.imul(A,ee)|0,u=u+Math.imul(A,et)|0,i=i+Math.imul(S,ei)|0,n=(n=n+Math.imul(S,en)|0)+Math.imul(B,ei)|0,u=u+Math.imul(B,en)|0;var eR=(g+(i=i+Math.imul(_,eo)|0)|0)+((8191&(n=(n=n+Math.imul(_,es)|0)+Math.imul(w,eo)|0))<<13)|0;g=((u=u+Math.imul(w,es)|0)+(n>>>13)|0)+(eR>>>26)|0,eR&=67108863,i=Math.imul(I,Y),n=(n=Math.imul(I,$))+Math.imul(C,Y)|0,u=Math.imul(C,$),i=i+Math.imul(R,ee)|0,n=(n=n+Math.imul(R,et)|0)+Math.imul(P,ee)|0,u=u+Math.imul(P,et)|0,i=i+Math.imul(k,ei)|0,n=(n=n+Math.imul(k,en)|0)+Math.imul(A,ei)|0,u=u+Math.imul(A,en)|0,i=i+Math.imul(S,eo)|0,n=(n=n+Math.imul(S,es)|0)+Math.imul(B,eo)|0,u=u+Math.imul(B,es)|0;var eP=(g+(i=i+Math.imul(_,eh)|0)|0)+((8191&(n=(n=n+Math.imul(_,ed)|0)+Math.imul(w,eh)|0))<<13)|0;g=((u=u+Math.imul(w,ed)|0)+(n>>>13)|0)+(eP>>>26)|0,eP&=67108863,i=Math.imul(T,Y),n=(n=Math.imul(T,$))+Math.imul(j,Y)|0,u=Math.imul(j,$),i=i+Math.imul(I,ee)|0,n=(n=n+Math.imul(I,et)|0)+Math.imul(C,ee)|0,u=u+Math.imul(C,et)|0,i=i+Math.imul(R,ei)|0,n=(n=n+Math.imul(R,en)|0)+Math.imul(P,ei)|0,u=u+Math.imul(P,en)|0,i=i+Math.imul(k,eo)|0,n=(n=n+Math.imul(k,es)|0)+Math.imul(A,eo)|0,u=u+Math.imul(A,es)|0,i=i+Math.imul(S,eh)|0,n=(n=n+Math.imul(S,ed)|0)+Math.imul(B,eh)|0,u=u+Math.imul(B,ed)|0;var ex=(g+(i=i+Math.imul(_,eu)|0)|0)+((8191&(n=(n=n+Math.imul(_,el)|0)+Math.imul(w,eu)|0))<<13)|0;g=((u=u+Math.imul(w,el)|0)+(n>>>13)|0)+(ex>>>26)|0,ex&=67108863,i=Math.imul(H,Y),n=(n=Math.imul(H,$))+Math.imul(q,Y)|0,u=Math.imul(q,$),i=i+Math.imul(T,ee)|0,n=(n=n+Math.imul(T,et)|0)+Math.imul(j,ee)|0,u=u+Math.imul(j,et)|0,i=i+Math.imul(I,ei)|0,n=(n=n+Math.imul(I,en)|0)+Math.imul(C,ei)|0,u=u+Math.imul(C,en)|0,i=i+Math.imul(R,eo)|0,n=(n=n+Math.imul(R,es)|0)+Math.imul(P,eo)|0,u=u+Math.imul(P,es)|0,i=i+Math.imul(k,eh)|0,n=(n=n+Math.imul(k,ed)|0)+Math.imul(A,eh)|0,u=u+Math.imul(A,ed)|0,i=i+Math.imul(S,eu)|0,n=(n=n+Math.imul(S,el)|0)+Math.imul(B,eu)|0,u=u+Math.imul(B,el)|0;var eI=(g+(i=i+Math.imul(_,eb)|0)|0)+((8191&(n=(n=n+Math.imul(_,em)|0)+Math.imul(w,eb)|0))<<13)|0;g=((u=u+Math.imul(w,em)|0)+(n>>>13)|0)+(eI>>>26)|0,eI&=67108863,i=Math.imul(z,Y),n=(n=Math.imul(z,$))+Math.imul(U,Y)|0,u=Math.imul(U,$),i=i+Math.imul(H,ee)|0,n=(n=n+Math.imul(H,et)|0)+Math.imul(q,ee)|0,u=u+Math.imul(q,et)|0,i=i+Math.imul(T,ei)|0,n=(n=n+Math.imul(T,en)|0)+Math.imul(j,ei)|0,u=u+Math.imul(j,en)|0,i=i+Math.imul(I,eo)|0,n=(n=n+Math.imul(I,es)|0)+Math.imul(C,eo)|0,u=u+Math.imul(C,es)|0,i=i+Math.imul(R,eh)|0,n=(n=n+Math.imul(R,ed)|0)+Math.imul(P,eh)|0,u=u+Math.imul(P,ed)|0,i=i+Math.imul(k,eu)|0,n=(n=n+Math.imul(k,el)|0)+Math.imul(A,eu)|0,u=u+Math.imul(A,el)|0,i=i+Math.imul(S,eb)|0,n=(n=n+Math.imul(S,em)|0)+Math.imul(B,eb)|0,u=u+Math.imul(B,em)|0;var eC=(g+(i=i+Math.imul(_,eg)|0)|0)+((8191&(n=(n=n+Math.imul(_,ev)|0)+Math.imul(w,eg)|0))<<13)|0;g=((u=u+Math.imul(w,ev)|0)+(n>>>13)|0)+(eC>>>26)|0,eC&=67108863,i=Math.imul(W,Y),n=(n=Math.imul(W,$))+Math.imul(V,Y)|0,u=Math.imul(V,$),i=i+Math.imul(z,ee)|0,n=(n=n+Math.imul(z,et)|0)+Math.imul(U,ee)|0,u=u+Math.imul(U,et)|0,i=i+Math.imul(H,ei)|0,n=(n=n+Math.imul(H,en)|0)+Math.imul(q,ei)|0,u=u+Math.imul(q,en)|0,i=i+Math.imul(T,eo)|0,n=(n=n+Math.imul(T,es)|0)+Math.imul(j,eo)|0,u=u+Math.imul(j,es)|0,i=i+Math.imul(I,eh)|0,n=(n=n+Math.imul(I,ed)|0)+Math.imul(C,eh)|0,u=u+Math.imul(C,ed)|0,i=i+Math.imul(R,eu)|0,n=(n=n+Math.imul(R,el)|0)+Math.imul(P,eu)|0,u=u+Math.imul(P,el)|0,i=i+Math.imul(k,eb)|0,n=(n=n+Math.imul(k,em)|0)+Math.imul(A,eb)|0,u=u+Math.imul(A,em)|0,i=i+Math.imul(S,eg)|0,n=(n=n+Math.imul(S,ev)|0)+Math.imul(B,eg)|0,u=u+Math.imul(B,ev)|0;var eD=(g+(i=i+Math.imul(_,ew)|0)|0)+((8191&(n=(n=n+Math.imul(_,eM)|0)+Math.imul(w,ew)|0))<<13)|0;g=((u=u+Math.imul(w,eM)|0)+(n>>>13)|0)+(eD>>>26)|0,eD&=67108863,i=Math.imul(Z,Y),n=(n=Math.imul(Z,$))+Math.imul(J,Y)|0,u=Math.imul(J,$),i=i+Math.imul(W,ee)|0,n=(n=n+Math.imul(W,et)|0)+Math.imul(V,ee)|0,u=u+Math.imul(V,et)|0,i=i+Math.imul(z,ei)|0,n=(n=n+Math.imul(z,en)|0)+Math.imul(U,ei)|0,u=u+Math.imul(U,en)|0,i=i+Math.imul(H,eo)|0,n=(n=n+Math.imul(H,es)|0)+Math.imul(q,eo)|0,u=u+Math.imul(q,es)|0,i=i+Math.imul(T,eh)|0,n=(n=n+Math.imul(T,ed)|0)+Math.imul(j,eh)|0,u=u+Math.imul(j,ed)|0,i=i+Math.imul(I,eu)|0,n=(n=n+Math.imul(I,el)|0)+Math.imul(C,eu)|0,u=u+Math.imul(C,el)|0,i=i+Math.imul(R,eb)|0,n=(n=n+Math.imul(R,em)|0)+Math.imul(P,eb)|0,u=u+Math.imul(P,em)|0,i=i+Math.imul(k,eg)|0,n=(n=n+Math.imul(k,ev)|0)+Math.imul(A,eg)|0,u=u+Math.imul(A,ev)|0,i=i+Math.imul(S,ew)|0,n=(n=n+Math.imul(S,eM)|0)+Math.imul(B,ew)|0,u=u+Math.imul(B,eM)|0;var eT=(g+(i=i+Math.imul(_,eB)|0)|0)+((8191&(n=(n=n+Math.imul(_,eE)|0)+Math.imul(w,eB)|0))<<13)|0;g=((u=u+Math.imul(w,eE)|0)+(n>>>13)|0)+(eT>>>26)|0,eT&=67108863,i=Math.imul(Z,ee),n=(n=Math.imul(Z,et))+Math.imul(J,ee)|0,u=Math.imul(J,et),i=i+Math.imul(W,ei)|0,n=(n=n+Math.imul(W,en)|0)+Math.imul(V,ei)|0,u=u+Math.imul(V,en)|0,i=i+Math.imul(z,eo)|0,n=(n=n+Math.imul(z,es)|0)+Math.imul(U,eo)|0,u=u+Math.imul(U,es)|0,i=i+Math.imul(H,eh)|0,n=(n=n+Math.imul(H,ed)|0)+Math.imul(q,eh)|0,u=u+Math.imul(q,ed)|0,i=i+Math.imul(T,eu)|0,n=(n=n+Math.imul(T,el)|0)+Math.imul(j,eu)|0,u=u+Math.imul(j,el)|0,i=i+Math.imul(I,eb)|0,n=(n=n+Math.imul(I,em)|0)+Math.imul(C,eb)|0,u=u+Math.imul(C,em)|0,i=i+Math.imul(R,eg)|0,n=(n=n+Math.imul(R,ev)|0)+Math.imul(P,eg)|0,u=u+Math.imul(P,ev)|0,i=i+Math.imul(k,ew)|0,n=(n=n+Math.imul(k,eM)|0)+Math.imul(A,ew)|0,u=u+Math.imul(A,eM)|0;var ej=(g+(i=i+Math.imul(S,eB)|0)|0)+((8191&(n=(n=n+Math.imul(S,eE)|0)+Math.imul(B,eB)|0))<<13)|0;g=((u=u+Math.imul(B,eE)|0)+(n>>>13)|0)+(ej>>>26)|0,ej&=67108863,i=Math.imul(Z,ei),n=(n=Math.imul(Z,en))+Math.imul(J,ei)|0,u=Math.imul(J,en),i=i+Math.imul(W,eo)|0,n=(n=n+Math.imul(W,es)|0)+Math.imul(V,eo)|0,u=u+Math.imul(V,es)|0,i=i+Math.imul(z,eh)|0,n=(n=n+Math.imul(z,ed)|0)+Math.imul(U,eh)|0,u=u+Math.imul(U,ed)|0,i=i+Math.imul(H,eu)|0,n=(n=n+Math.imul(H,el)|0)+Math.imul(q,eu)|0,u=u+Math.imul(q,el)|0,i=i+Math.imul(T,eb)|0,n=(n=n+Math.imul(T,em)|0)+Math.imul(j,eb)|0,u=u+Math.imul(j,em)|0,i=i+Math.imul(I,eg)|0,n=(n=n+Math.imul(I,ev)|0)+Math.imul(C,eg)|0,u=u+Math.imul(C,ev)|0,i=i+Math.imul(R,ew)|0,n=(n=n+Math.imul(R,eM)|0)+Math.imul(P,ew)|0,u=u+Math.imul(P,eM)|0;var eO=(g+(i=i+Math.imul(k,eB)|0)|0)+((8191&(n=(n=n+Math.imul(k,eE)|0)+Math.imul(A,eB)|0))<<13)|0;g=((u=u+Math.imul(A,eE)|0)+(n>>>13)|0)+(eO>>>26)|0,eO&=67108863,i=Math.imul(Z,eo),n=(n=Math.imul(Z,es))+Math.imul(J,eo)|0,u=Math.imul(J,es),i=i+Math.imul(W,eh)|0,n=(n=n+Math.imul(W,ed)|0)+Math.imul(V,eh)|0,u=u+Math.imul(V,ed)|0,i=i+Math.imul(z,eu)|0,n=(n=n+Math.imul(z,el)|0)+Math.imul(U,eu)|0,u=u+Math.imul(U,el)|0,i=i+Math.imul(H,eb)|0,n=(n=n+Math.imul(H,em)|0)+Math.imul(q,eb)|0,u=u+Math.imul(q,em)|0,i=i+Math.imul(T,eg)|0,n=(n=n+Math.imul(T,ev)|0)+Math.imul(j,eg)|0,u=u+Math.imul(j,ev)|0,i=i+Math.imul(I,ew)|0,n=(n=n+Math.imul(I,eM)|0)+Math.imul(C,ew)|0,u=u+Math.imul(C,eM)|0;var eH=(g+(i=i+Math.imul(R,eB)|0)|0)+((8191&(n=(n=n+Math.imul(R,eE)|0)+Math.imul(P,eB)|0))<<13)|0;g=((u=u+Math.imul(P,eE)|0)+(n>>>13)|0)+(eH>>>26)|0,eH&=67108863,i=Math.imul(Z,eh),n=(n=Math.imul(Z,ed))+Math.imul(J,eh)|0,u=Math.imul(J,ed),i=i+Math.imul(W,eu)|0,n=(n=n+Math.imul(W,el)|0)+Math.imul(V,eu)|0,u=u+Math.imul(V,el)|0,i=i+Math.imul(z,eb)|0,n=(n=n+Math.imul(z,em)|0)+Math.imul(U,eb)|0,u=u+Math.imul(U,em)|0,i=i+Math.imul(H,eg)|0,n=(n=n+Math.imul(H,ev)|0)+Math.imul(q,eg)|0,u=u+Math.imul(q,ev)|0,i=i+Math.imul(T,ew)|0,n=(n=n+Math.imul(T,eM)|0)+Math.imul(j,ew)|0,u=u+Math.imul(j,eM)|0;var eq=(g+(i=i+Math.imul(I,eB)|0)|0)+((8191&(n=(n=n+Math.imul(I,eE)|0)+Math.imul(C,eB)|0))<<13)|0;g=((u=u+Math.imul(C,eE)|0)+(n>>>13)|0)+(eq>>>26)|0,eq&=67108863,i=Math.imul(Z,eu),n=(n=Math.imul(Z,el))+Math.imul(J,eu)|0,u=Math.imul(J,el),i=i+Math.imul(W,eb)|0,n=(n=n+Math.imul(W,em)|0)+Math.imul(V,eb)|0,u=u+Math.imul(V,em)|0,i=i+Math.imul(z,eg)|0,n=(n=n+Math.imul(z,ev)|0)+Math.imul(U,eg)|0,u=u+Math.imul(U,ev)|0,i=i+Math.imul(H,ew)|0,n=(n=n+Math.imul(H,eM)|0)+Math.imul(q,ew)|0,u=u+Math.imul(q,eM)|0;var eL=(g+(i=i+Math.imul(T,eB)|0)|0)+((8191&(n=(n=n+Math.imul(T,eE)|0)+Math.imul(j,eB)|0))<<13)|0;g=((u=u+Math.imul(j,eE)|0)+(n>>>13)|0)+(eL>>>26)|0,eL&=67108863,i=Math.imul(Z,eb),n=(n=Math.imul(Z,em))+Math.imul(J,eb)|0,u=Math.imul(J,em),i=i+Math.imul(W,eg)|0,n=(n=n+Math.imul(W,ev)|0)+Math.imul(V,eg)|0,u=u+Math.imul(V,ev)|0,i=i+Math.imul(z,ew)|0,n=(n=n+Math.imul(z,eM)|0)+Math.imul(U,ew)|0,u=u+Math.imul(U,eM)|0;var ez=(g+(i=i+Math.imul(H,eB)|0)|0)+((8191&(n=(n=n+Math.imul(H,eE)|0)+Math.imul(q,eB)|0))<<13)|0;g=((u=u+Math.imul(q,eE)|0)+(n>>>13)|0)+(ez>>>26)|0,ez&=67108863,i=Math.imul(Z,eg),n=(n=Math.imul(Z,ev))+Math.imul(J,eg)|0,u=Math.imul(J,ev),i=i+Math.imul(W,ew)|0,n=(n=n+Math.imul(W,eM)|0)+Math.imul(V,ew)|0,u=u+Math.imul(V,eM)|0;var eK=(g+(i=i+Math.imul(z,eB)|0)|0)+((8191&(n=(n=n+Math.imul(z,eE)|0)+Math.imul(U,eB)|0))<<13)|0;g=((u=u+Math.imul(U,eE)|0)+(n>>>13)|0)+(eK>>>26)|0,eK&=67108863,i=Math.imul(Z,ew),n=(n=Math.imul(Z,eM))+Math.imul(J,ew)|0,u=Math.imul(J,eM);var eU=(g+(i=i+Math.imul(W,eB)|0)|0)+((8191&(n=(n=n+Math.imul(W,eE)|0)+Math.imul(V,eB)|0))<<13)|0;g=((u=u+Math.imul(V,eE)|0)+(n>>>13)|0)+(eU>>>26)|0,eU&=67108863;var eF=(g+(i=Math.imul(Z,eB))|0)+((8191&(n=(n=Math.imul(Z,eE))+Math.imul(J,eB)|0))<<13)|0;return g=((u=Math.imul(J,eE))+(n>>>13)|0)+(eF>>>26)|0,eF&=67108863,y[0]=ek,y[1]=eA,y[2]=eN,y[3]=eR,y[4]=eP,y[5]=ex,y[6]=eI,y[7]=eC,y[8]=eD,y[9]=eT,y[10]=ej,y[11]=eO,y[12]=eH,y[13]=eq,y[14]=eL,y[15]=ez,y[16]=eK,y[17]=eU,y[18]=eF,0!==g&&(y[19]=g,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,u=0;u>>26)|0)>>>26,b&=67108863}r.words[u]=m,i=b,b=n}return 0!==i?r.words[u]=i:r.length--,r._strip()}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(h=smallMulTo),BN.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):i<63?smallMulTo(this,e,t):bigMulTo(this,e,t)},FFTM.prototype.makeRBT=function(e){for(var t=Array(e),r=BN.prototype._countBits(e)-1,i=0;i>=1;return i},FFTM.prototype.permute=function(e,t,r,i,n,u){for(var b=0;b>>=1)n++;return 1<>>=13,r[2*u+1]=8191&n,n>>>=13;for(u=2*t;u>=26,r+=(n/67108864|0)+(u>>>26),this.words[i]=67108863&u}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function(e){return this.clone().imuln(e)},BN.prototype.sqr=function(){return this.mul(this)},BN.prototype.isqr=function(){return this.imul(this.clone())},BN.prototype.pow=function(e){var t=toBitArray(e);if(0===t.length)return new BN(1);for(var r=this,i=0;i=0);var t,r=e%26,i=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var u=0;for(t=0;t>>26-r}u&&(this.words[t]=u,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,n=e%26,u=Math.min((e-n)/26,this.length),b=67108863^67108863>>>n<u)for(this.length-=u,m=0;m=0&&(0!==y||m>=i);m--){var g=0|this.words[m];this.words[m]=y<<26-n|g>>>n,y=g&b}return r&&0!==y&&(r.words[r.length++]=y),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function(e){return this.clone().ishln(e)},BN.prototype.ushln=function(e){return this.clone().iushln(e)},BN.prototype.shrn=function(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function(e){return this.clone().iushrn(e)},BN.prototype.testn=function(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(m/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===b)return this._strip();for(assert(-1===b),b=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function(e,t){var r,i=this.length-e.length,n=this.clone(),u=e,b=0|u.words[u.length-1];0!=(i=26-this._countBits(b))&&(u=u.ushln(i),n.iushln(i),b=0|u.words[u.length-1]);var m=n.length-u.length;if("mod"!==t){(r=new BN(null)).length=m+1,r.words=Array(r.length);for(var y=0;y=0;v--){var _=(0|n.words[u.length+v])*67108864+(0|n.words[u.length+v-1]);for(_=Math.min(_/b|0,67108863),n._ishlnsubmul(u,_,v);0!==n.negative;)_--,n.negative=0,n._ishlnsubmul(u,1,v),n.isZero()||(n.negative^=1);r&&(r.words[v]=_)}return r&&r._strip(),n._strip(),"div"!==t&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},BN.prototype.divmod=function(e,t,r){var i,n,u;return(assert(!e.isZero()),this.isZero())?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(u=this.neg().divmod(e,t),"mod"!==t&&(i=u.div.neg()),"div"!==t&&(n=u.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:i,mod:n}):0===this.negative&&0!==e.negative?(u=this.divmod(e.neg(),t),"mod"!==t&&(i=u.div.neg()),{div:i,mod:u.mod}):(this.negative&e.negative)!=0?(u=this.neg().divmod(e.neg(),t),"div"!==t&&(n=u.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:u.div,mod:n}):e.length>this.length||0>this.cmp(e)?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t)},BN.prototype.div=function(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),u=r.cmp(i);return u<0||1===n&&0===u?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=67108864%e,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%e;return t?-i:i},BN.prototype.modn=function(e){return this.modrn(e)},BN.prototype.idivn=function(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function(e){return this.clone().idivn(e)},BN.prototype.egcd=function(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new BN(1),n=new BN(0),u=new BN(0),b=new BN(1),m=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++m;for(var y=r.clone(),g=t.clone();!t.isZero();){for(var v=0,_=1;(t.words[0]&_)==0&&v<26;++v,_<<=1);if(v>0)for(t.iushrn(v);v-- >0;)(i.isOdd()||n.isOdd())&&(i.iadd(y),n.isub(g)),i.iushrn(1),n.iushrn(1);for(var w=0,M=1;(r.words[0]&M)==0&&w<26;++w,M<<=1);if(w>0)for(r.iushrn(w);w-- >0;)(u.isOdd()||b.isOdd())&&(u.iadd(y),b.isub(g)),u.iushrn(1),b.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(u),n.isub(b)):(r.isub(t),u.isub(i),b.isub(n))}return{a:u,b:b,gcd:r.iushln(m)}},BN.prototype._invmp=function(e){assert(0===e.negative),assert(!e.isZero());var t,r=this,i=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var n=new BN(1),u=new BN(0),b=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var m=0,y=1;(r.words[0]&y)==0&&m<26;++m,y<<=1);if(m>0)for(r.iushrn(m);m-- >0;)n.isOdd()&&n.iadd(b),n.iushrn(1);for(var g=0,v=1;(i.words[0]&v)==0&&g<26;++g,v<<=1);if(g>0)for(i.iushrn(g);g-- >0;)u.isOdd()&&u.iadd(b),u.iushrn(1);r.cmp(i)>=0?(r.isub(i),n.isub(u)):(i.isub(r),u.isub(n))}return 0>(t=0===r.cmpn(1)?n:u).cmpn(0)&&t.iadd(e),t},BN.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var u=t;t=r,r=u}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},BN.prototype.invm=function(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function(){return(1&this.words[0])==0},BN.prototype.isOdd=function(){return(1&this.words[0])==1},BN.prototype.andln=function(e){return this.words[0]&e},BN.prototype.bincn=function(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,b&=67108863,this.words[u]=b}return 0!==n&&(this.words[u]=n,this.length++),this},BN.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){in&&(t=1);break}}return t},BN.prototype.gtn=function(e){return 1===this.cmpn(e)},BN.prototype.gt=function(e){return 1===this.cmp(e)},BN.prototype.gten=function(e){return this.cmpn(e)>=0},BN.prototype.gte=function(e){return this.cmp(e)>=0},BN.prototype.ltn=function(e){return -1===this.cmpn(e)},BN.prototype.lt=function(e){return -1===this.cmp(e)},BN.prototype.lten=function(e){return 0>=this.cmpn(e)},BN.prototype.lte=function(e){return 0>=this.cmp(e)},BN.prototype.eqn=function(e){return 0===this.cmpn(e)},BN.prototype.eq=function(e){return 0===this.cmp(e)},BN.red=function(e){return new Red(e)},BN.prototype.toRed=function(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function(e){return this.red=e,this},BN.prototype.forceRed=function(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function(){var e=new BN(null);return e.words=Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var i=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i>>22,n=u}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function(e){var t;if(m[e])return m[e];if("k256"===e)t=new K256;else if("p224"===e)t=new P224;else if("p192"===e)t=new P192;else if("p25519"===e)t=new P25519;else throw Error("Unknown prime "+e);return m[e]=t,t},Red.prototype._verify1=function(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function(e,t){assert((e.negative|t.negative)==0,"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},Red.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function(e){return this.imul(e,e.clone())},Red.prototype.sqr=function(e){return this.mul(e,e)},Red.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),n=0;!i.isZero()&&0===i.andln(1);)n++,i.iushrn(1);assert(!i.isZero());var u=new BN(1).toRed(this),b=u.redNeg(),m=this.m.subn(1).iushrn(1),y=this.m.bitLength();for(y=new BN(2*y*y).toRed(this);0!==this.pow(y,m).cmp(b);)y.redIAdd(b);for(var g=this.pow(y,i),v=this.pow(e,i.addn(1).iushrn(1)),_=this.pow(e,i),w=n;0!==_.cmp(u);){for(var M=_,S=0;0!==M.cmp(u);S++)M=M.redSqr();assert(S=0;i--){for(var y=t.words[i],g=m-1;g>=0;g--){var v=y>>g&1;if(n!==r[0]&&(n=this.sqr(n)),0===v&&0===u){b=0;continue}u<<=1,u|=v,(4==++b||0===i&&0===g)&&(n=this.mul(n,r[u]),b=0,u=0)}m=26}return n},Red.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},BN.mont=function(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),u=n;return n.cmp(this.m)>=0?u=n.isub(this.m):0>n.cmpn(0)&&(u=n.iadd(this.m)),u._forceRed(this)},Mont.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),u=n;return n.cmp(this.m)>=0?u=n.isub(this.m):0>n.cmpn(0)&&(u=n.iadd(this.m)),u._forceRed(this)},Mont.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},3500:function(e,t,r){var i;function Rand(e){this.rand=e}if(e.exports=function(e){return i||(i=new Rand(null)),i.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function(e){return this._rand(e)},Rand.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^v[S>>>16&255]^_[B>>>8&255]^w[255&E]^t[k++],b=g[S>>>24]^v[B>>>16&255]^_[E>>>8&255]^w[255&M]^t[k++],m=g[B>>>24]^v[E>>>16&255]^_[M>>>8&255]^w[255&S]^t[k++],y=g[E>>>24]^v[M>>>16&255]^_[S>>>8&255]^w[255&B]^t[k++],M=u,S=b,B=m,E=y;return u=(i[M>>>24]<<24|i[S>>>16&255]<<16|i[B>>>8&255]<<8|i[255&E])^t[k++],b=(i[S>>>24]<<24|i[B>>>16&255]<<16|i[E>>>8&255]<<8|i[255&M])^t[k++],[u>>>=0,b>>>=0,m=((i[B>>>24]<<24|i[E>>>16&255]<<16|i[M>>>8&255]<<8|i[255&S])^t[k++])>>>0,y=((i[E>>>24]<<24|i[M>>>16&255]<<16|i[S>>>8&255]<<8|i[255&B])^t[k++])>>>0]}var n=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],u=[[],[],[],[]],b=0,m=0,y=0;y<256;++y){var g=m^m<<1^m<<2^m<<3^m<<4;g=g>>>8^255&g^99,r[b]=g,i[g]=b;var v=e[b],_=e[v],w=e[_],M=257*e[g]^16843008*g;n[0][b]=M<<24|M>>>8,n[1][b]=M<<16|M>>>16,n[2][b]=M<<8|M>>>24,n[3][b]=M,M=16843009*w^65537*_^257*v^16843008*b,u[0][g]=M<<24|M>>>8,u[1][g]=M<<16|M>>>16,u[2][g]=M<<8|M>>>24,u[3][g]=M,0===b?b=m=1:(b=v^e[e[e[w^v]]],m^=e[e[m]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:u}}();function AES(e){this._key=asUInt32Array(e),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=(r+1)*4,b=[],m=0;m>>24,y=(u.SBOX[y>>>24]<<24|u.SBOX[y>>>16&255]<<16|u.SBOX[y>>>8&255]<<8|u.SBOX[255&y])^n[m/t|0]<<24):t>6&&m%t==4&&(y=u.SBOX[y>>>24]<<24|u.SBOX[y>>>16&255]<<16|u.SBOX[y>>>8&255]<<8|u.SBOX[255&y]),b[m]=b[m-t]^y}for(var g=[],v=0;v>>24]]^u.INV_SUB_MIX[1][u.SBOX[w>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[w>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&w]]}this._nRounds=r,this._keySchedule=b,this._invKeySchedule=g},AES.prototype.encryptBlockRaw=function(e){return cryptBlock(e=asUInt32Array(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},AES.prototype.decryptBlock=function(e){var t=(e=asUInt32Array(e))[1];e[1]=e[3],e[3]=t;var r=cryptBlock(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},e.exports.AES=AES},6624:function(e,t,r){var i=r(1387),n=r(6911).Buffer,u=r(1043),b=r(3782),m=r(7225),y=r(4734),g=r(598);function xorTest(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n16)throw Error("unable to decrypt data");for(var r=-1;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=createDecipher,t.createDecipheriv=createDecipheriv},2:function(e,t,r){var i=r(6370),n=r(6624),u=r(6911).Buffer,b=r(126),m=r(1043),y=r(1387),g=r(8368);function Cipher(e,t,r){m.call(this),this._cache=new Splitter,this._cipher=new y.AES(t),this._prev=u.from(r),this._mode=e,this._autopadding=!0}r(3782)(Cipher,m),Cipher.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return u.concat(i)};var v=u.alloc(16,16);function Splitter(){this.cache=u.allocUnsafe(0)}function createCipheriv(e,t,r){var m=i[e.toLowerCase()];if(!m)throw TypeError("invalid suite type");if("string"==typeof t&&(t=u.from(t)),t.length!==m.key/8)throw TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=u.from(r)),"GCM"!==m.mode&&r.length!==m.iv)throw TypeError("invalid iv length "+r.length);return"stream"===m.type?new b(m.module,t,r):"auth"===m.type?new n(m.module,t,r):new Cipher(m.module,t,r)}function createCipher(e,t){var r=i[e.toLowerCase()];if(!r)throw TypeError("invalid suite type");var n=g(t,!1,r.key,r.iv);return createCipheriv(e,n.key,n.iv)}Cipher.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(v))throw this._cipher.scrub(),Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Splitter.prototype.add=function(e){this.cache=u.concat([this.cache,e])},Splitter.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Splitter.prototype.flush=function(){for(var e=16-this.cache.length,t=u.allocUnsafe(e),r=-1;++r>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function GHASH(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}GHASH.prototype.ghash=function(e){for(var t=-1;++t0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,t&&(r[0]=-520093696^r[0])}this.state=fromArray(i)},GHASH.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},GHASH.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(fromArray([0,e,0,t])),this.state},e.exports=GHASH},598:function(e){function incr32(e){for(var t,r=e.length;r--;)if(255===(t=e.readUInt8(r)))e.writeUInt8(0,r);else{t++,e.writeUInt8(t,r);break}}e.exports=incr32},9825:function(e,t,r){var i=r(4734);t.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;return e._prev=t,i(e._cipher.decryptBlock(t),r)}},321:function(e,t,r){var i=r(6911).Buffer,n=r(4734);function encryptStart(e,t,r){var u=t.length,b=n(t,e._cache);return e._cache=e._cache.slice(u),e._prev=i.concat([e._prev,r?t:b]),b}t.encrypt=function(e,t,r){for(var n,u=i.allocUnsafe(0);t.length;)if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),e._cache.length<=t.length)n=e._cache.length,u=i.concat([u,encryptStart(e,t.slice(0,n),r)]),t=t.slice(n);else{u=i.concat([u,encryptStart(e,t,r)]);break}return u}},3147:function(e,t,r){var i=r(6911).Buffer;function encryptByte(e,t,r){for(var i,n,u,b=-1,m=0;++b<8;)i=e._cipher.encryptBlock(e._prev),n=t&1<<7-b?128:0,m+=(128&(u=i[0]^n))>>b%8,e._prev=shiftIn(e._prev,r?n:u);return m}function shiftIn(e,t){var r=e.length,n=-1,u=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n>7;return u}t.encrypt=function(e,t,r){for(var n=t.length,u=i.allocUnsafe(n),b=-1;++b=0||!r.umod(e.prime1)||!r.umod(e.prime2);)r=new n(u(t));return r}e.exports=crt,crt.getr=getr},9276:function(e,t,r){e.exports=r(2908)},4078:function(e,t,r){var i=r(6911).Buffer,n=r(9739),u=r(3726),b=r(3782),m=r(9807),y=r(4013),g=r(2908);function Sign(e){u.Writable.call(this);var t=g[e];if(!t)throw Error("Unknown message digest");this._hashType=t.hash,this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function Verify(e){u.Writable.call(this);var t=g[e];if(!t)throw Error("Unknown message digest");this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}Object.keys(g).forEach(function(e){g[e].id=i.from(g[e].id,"hex"),g[e.toLowerCase()]=g[e]}),b(Sign,u.Writable),Sign.prototype._write=function(e,t,r){this._hash.update(e),r()},Sign.prototype.update=function(e,t){return"string"==typeof e&&(e=i.from(e,t)),this._hash.update(e),this},Sign.prototype.sign=function(e,t){this.end();var r=m(this._hash.digest(),e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},b(Verify,u.Writable),Verify.prototype._write=function(e,t,r){this._hash.update(e),r()},Verify.prototype.update=function(e,t){return"string"==typeof e&&(e=i.from(e,t)),this._hash.update(e),this},Verify.prototype.verify=function(e,t,r){return"string"==typeof t&&(t=i.from(t,r)),this.end(),y(t,this._hash.digest(),e,this._signType,this._tag)},e.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify}},9807:function(e,t,r){var i=r(6911).Buffer,n=r(4873),u=r(7166),b=r(949).ec,m=r(1670),y=r(9902),g=r(9267);function sign(e,t,r,n,b){var m=y(t);if(m.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw Error("wrong private key type");return ecSign(e,m)}if("dsa"===m.type){if("dsa"!==n)throw Error("wrong private key type");return dsaSign(e,m,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw Error("wrong private key type");e=i.concat([b,e]);for(var g=m.modulus.byteLength(),v=[0,1];e.length+v.length+10&&r.ishrn(i),r}function bits2octets(e,t){e=(e=bits2int(e,t)).mod(t);var r=i.from(e.toArray());if(r.length=e.cmpn(0)||e.cmp(t)>=t)throw Error("invalid sig")}e.exports=verify},4734:function(e){e.exports=function(e,t){for(var r=Math.min(e.length,t.length),n=new i(r),u=0;ur?t=("rmd160"===e?new y:g(e)).update(t).digest():t.length64?t=e(t):t.length<64&&(t=n.concat([t,b],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),m=0;m<64;m++)r[m]=54^t[m],i[m]=92^t[m];this._hash=[r]}i(Hmac,u),Hmac.prototype._update=function(e){this._hash.push(e)},Hmac.prototype._final=function(){var e=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,e]))},e.exports=Hmac},9536:function(e,t,r){"use strict";t.utils=r(5334),t.Cipher=r(9876),t.DES=r(1016),t.CBC=r(8641),t.EDE=r(6159)},8641:function(e,t,r){"use strict";var i=r(3523),n=r(3782),u={};function CBCState(e){i.equal(e.length,8,"Invalid IV length"),this.iv=Array(8);for(var t=0;t0;i--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},Cipher.prototype.final=function(e){var t,r;return(e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t)?t.concat(r):r},Cipher.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];r=u.r28shl(r,y),n=u.r28shl(n,y),u.pc2(r,n,e.keys,b)}},DES.prototype._update=function(e,t,r,i){var n=this._desState,b=u.readUInt32BE(e,t),m=u.readUInt32BE(e,t+4);u.ip(b,m,n.tmp,0),b=n.tmp[0],m=n.tmp[1],"encrypt"===this.type?this._encrypt(n,b,m,n.tmp,0):this._decrypt(n,b,m,n.tmp,0),b=n.tmp[0],m=n.tmp[1],u.writeUInt32BE(r,b,i),u.writeUInt32BE(r,m,i+4)},DES.prototype._pad=function(e,t){for(var r=e.length-t,i=t;i>>0,b=M}u.rip(m,b,i,n)},DES.prototype._decrypt=function(e,t,r,i,n){for(var b=r,m=t,y=e.keys.length-2;y>=0;y-=2){var g=e.keys[y],v=e.keys[y+1];u.expand(b,e.tmp,0),g^=e.tmp[0],v^=e.tmp[1];var _=u.substitute(g,v),w=u.permute(_),M=b;b=(m^w)>>>0,m=M}u.rip(b,m,i,n)}},6159:function(e,t,r){"use strict";var i=r(3523),n=r(3782),u=r(9876),b=r(1016);function EDEState(e,t){i.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),u=t.slice(16,24);"encrypt"===e?this.ciphers=[b.create({type:"encrypt",key:r}),b.create({type:"decrypt",key:n}),b.create({type:"encrypt",key:u})]:this.ciphers=[b.create({type:"decrypt",key:u}),b.create({type:"encrypt",key:n}),b.create({type:"decrypt",key:r})]}function EDE(e){u.call(this,e);var t=new EDEState(this.type,this.options.key);this._edeState=t}n(EDE,u),e.exports=EDE,EDE.create=function(e){return new EDE(e)},EDE.prototype._update=function(e,t,r,i){var n=this._edeState;n.ciphers[0]._update(e,t,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},EDE.prototype._pad=b.prototype._pad,EDE.prototype._unpad=b.prototype._unpad},5334:function(e,t){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},t.ip=function(e,t,r,i){for(var n=0,u=0,b=6;b>=0;b-=2){for(var m=0;m<=24;m+=8)n<<=1,n|=t>>>m+b&1;for(var m=0;m<=24;m+=8)n<<=1,n|=e>>>m+b&1}for(var b=6;b>=0;b-=2){for(var m=1;m<=25;m+=8)u<<=1,u|=t>>>m+b&1;for(var m=1;m<=25;m+=8)u<<=1,u|=e>>>m+b&1}r[i+0]=n>>>0,r[i+1]=u>>>0},t.rip=function(e,t,r,i){for(var n=0,u=0,b=0;b<4;b++)for(var m=24;m>=0;m-=8)n<<=1,n|=t>>>m+b&1,n<<=1,n|=e>>>m+b&1;for(var b=4;b<8;b++)for(var m=24;m>=0;m-=8)u<<=1,u|=t>>>m+b&1,u<<=1,u|=e>>>m+b&1;r[i+0]=n>>>0,r[i+1]=u>>>0},t.pc1=function(e,t,r,i){for(var n=0,u=0,b=7;b>=5;b--){for(var m=0;m<=24;m+=8)n<<=1,n|=t>>m+b&1;for(var m=0;m<=24;m+=8)n<<=1,n|=e>>m+b&1}for(var m=0;m<=24;m+=8)n<<=1,n|=t>>m+b&1;for(var b=1;b<=3;b++){for(var m=0;m<=24;m+=8)u<<=1,u|=t>>m+b&1;for(var m=0;m<=24;m+=8)u<<=1,u|=e>>m+b&1}for(var m=0;m<=24;m+=8)u<<=1,u|=e>>m+b&1;r[i+0]=n>>>0,r[i+1]=u>>>0},t.r28shl=function(e,t){return e<>>28-t};var r=[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];t.pc2=function(e,t,i,n){for(var u=0,b=0,m=r.length>>>1,y=0;y>>r[y]&1;for(var y=m;y>>r[y]&1;i[n+0]=u>>>0,i[n+1]=b>>>0},t.expand=function(e,t,r){var i=0,n=0;i=(1&e)<<5|e>>>27;for(var u=23;u>=15;u-=4)i<<=6,i|=e>>>u&63;for(var u=11;u>=3;u-=4)n|=e>>>u&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=i>>>0,t[r+1]=n>>>0};var i=[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];t.substitute=function(e,t){for(var r=0,n=0;n<4;n++){var u=e>>>18-6*n&63,b=i[64*n+u];r<<=4,r|=b}for(var n=0;n<4;n++){var u=t>>>18-6*n&63,b=i[256+64*n+u];r<<=4,r|=b}return r>>>0};var n=[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];t.permute=function(e){for(var t=0,r=0;r>>n[r]&1;return t>>>0},t.padSplit=function(e,t,r){for(var i=e.toString(2);i.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(m),r.testn(1)||r.iadd(y),t.cmp(y)){if(!t.cmp(g))for(;r.mod(v).cmp(_);)r.iadd(M)}else for(;r.mod(u).cmp(w);)r.iadd(M);if(simpleSieve(S=r.shrn(1))&&simpleSieve(r)&&fermatTest(S)&&fermatTest(r)&&b.test(S)&&b.test(r))return r}}},949:function(e,t,r){"use strict";t.version=r(2531).i8,t.utils=r(4401),t.rand=r(3500),t.curve=r(9359),t.curves=r(6226),t.ec=r(4088),t.eddsa=r(8511)},2727:function(e,t,r){"use strict";var i=r(711),n=r(4401),u=n.getNAF,b=n.getJSF,m=n.assert;function BaseCurve(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function(){throw Error("Not implemented")},BaseCurve.prototype.validate=function(){throw Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(e,t){m(e.precomputed);var r=e._getDoubles(),i=u(t,1,this._bitLength),n=(1<=y;t--)g=(g<<1)+i[t];b.push(g)}for(var v=this.jpoint(null,null,null),_=this.jpoint(null,null,null),w=n;w>0;w--){for(var y=0;y=0;g--){for(var t=0;g>=0&&0===b[g];g--)t++;if(g>=0&&t++,y=y.dblp(t),g<0)break;var v=b[g];m(0!==v),y="affine"===e.type?v>0?y.mixedAdd(n[v-1>>1]):y.mixedAdd(n[-v-1>>1].neg()):v>0?y.add(n[v-1>>1]):y.add(n[-v-1>>1].neg())}return"affine"===e.type?y.toP():y},BaseCurve.prototype._wnafMulAdd=function(e,t,r,i,n){for(var m=this._wnafT1,y=this._wnafT2,g=this._wnafT3,v=0,_=0;_=1;_-=2){var S=_-1,B=_;if(1!==m[S]||1!==m[B]){g[S]=u(r[S],m[S],this._bitLength),g[B]=u(r[B],m[B],this._bitLength),v=Math.max(g[S].length,v),v=Math.max(g[B].length,v);continue}var E=[t[S],null,null,t[B]];0===t[S].y.cmp(t[B].y)?(E[1]=t[S].add(t[B]),E[2]=t[S].toJ().mixedAdd(t[B].neg())):0===t[S].y.cmp(t[B].y.redNeg())?(E[1]=t[S].toJ().mixedAdd(t[B]),E[2]=t[S].add(t[B].neg())):(E[1]=t[S].toJ().mixedAdd(t[B]),E[2]=t[S].toJ().mixedAdd(t[B].neg()));var k=[-3,-1,-5,-7,0,7,5,1,3],A=b(r[S],r[B]);v=Math.max(A[0].length,v),g[S]=Array(v),g[B]=Array(v);for(var N=0;N=0;_--){for(var C=0;_>=0;){for(var D=!0,N=0;N=0&&C++,x=x.dblp(C),_<0)break;for(var N=0;N0?w=y[N][T-1>>1]:T<0&&(w=y[N][-T-1>>1].neg()),x="affine"===w.type?x.mixedAdd(w):x.add(w))}}for(var _=0;_=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n":""},Point.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.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),u=i.redAdd(t),b=u.redSub(r),m=i.redSub(t),y=n.redMul(b),g=u.redMul(m),v=n.redMul(m),_=b.redMul(u);return this.curve.point(y,g,_,v)},Point.prototype._projDbl=function(){var e,t,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var b=this.curve._mulA(n),m=b.redAdd(u);if(this.zOne)e=i.redSub(n).redSub(u).redMul(m.redSub(this.curve.two)),t=m.redMul(b.redSub(u)),r=m.redSqr().redSub(m).redSub(m);else{var y=this.z.redSqr(),g=m.redSub(y).redISub(y);e=i.redSub(n).redISub(u).redMul(g),t=m.redMul(b.redSub(u)),r=m.redMul(g)}}else{var b=n.redAdd(u),y=this.curve._mulC(this.z).redSqr(),g=b.redSub(y).redSub(y);e=this.curve._mulC(i.redISub(b)).redMul(g),t=this.curve._mulC(b).redMul(n.redISub(u)),r=b.redMul(g)}return this.curve.point(e,t,r)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),u=r.redSub(t),b=n.redSub(i),m=n.redAdd(i),y=r.redAdd(t),g=u.redMul(b),v=m.redMul(y),_=u.redMul(y),w=b.redMul(m);return this.curve.point(g,v,w,_)},Point.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),u=this.x.redMul(e.x),b=this.y.redMul(e.y),m=this.curve.d.redMul(u).redMul(b),y=n.redSub(m),g=n.redAdd(m),v=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(u).redISub(b),_=i.redMul(y).redMul(v);return this.curve.twisted?(t=i.redMul(g).redMul(b.redSub(this.curve._mulA(u))),r=y.redMul(g)):(t=i.redMul(g).redMul(b.redSub(u)),r=this.curve._mulC(y).redMul(g)),this.curve.point(_,t,r)},Point.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add},9359:function(e,t,r){"use strict";t.base=r(2727),t.short=r(4720),t.mont=r(6653),t.edwards=r(2705)},6653:function(e,t,r){"use strict";var i=r(711),n=r(3782),u=r(2727),b=r(4401);function MontCurve(e){u.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(e,t,r){u.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(MontCurve,u),e.exports=MontCurve,MontCurve.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(Point,u.BasePoint),MontCurve.prototype.decodePoint=function(e,t){return this.point(b.toArray(e,t),1)},MontCurve.prototype.point=function(e,t){return new Point(this,e,t)},MontCurve.prototype.pointFromJSON=function(e){return Point.fromJSON(this,e)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(e,t){return new Point(e,t[0],t[1]||e.one)},Point.prototype.inspect=function(){return this.isInfinity()?"":""},Point.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},Point.prototype.add=function(){throw Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),u=e.x.redSub(e.z).redMul(r),b=n.redMul(i),m=t.z.redMul(u.redAdd(b).redSqr()),y=t.x.redMul(u.redISub(b).redSqr());return this.curve.point(m,y)},Point.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var u=n.length-1;u>=0;u--)0===n[u]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},Point.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},Point.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},4720:function(e,t,r){"use strict";var i=r(4401),n=r(711),u=r(3782),b=r(2727),m=i.assert;function ShortCurve(e){b.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function Point(e,t,r,i){b.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(e,t,r,i){b.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}u(ShortCurve,b),e.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var t,r,i,u=this._getEndoRoots(this.p);t=(t=0>u[0].cmp(u[1])?u[0]:u[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var b=this._getEndoRoots(this.n);0===this.g.mul(b[0]).x.cmp(this.g.x.redMul(t))?r=b[0]:(r=b[1],m(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return i=e.basis?e.basis.map(function(e){return{a:new n(e.a,16),b:new n(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:i}}},ShortCurve.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),u=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(u).fromRed(),i.redSub(u).fromRed()]},ShortCurve.prototype._getEndoBasis=function(e){for(var t,r,i,u,b,m,y,g,v,_=this.n.ushrn(Math.floor(this.n.bitLength()/2)),w=e,M=this.n.clone(),S=new n(1),B=new n(0),E=new n(0),k=new n(1),A=0;0!==w.cmpn(0);){var N=M.div(w);g=M.sub(N.mul(w)),v=E.sub(N.mul(S));var R=k.sub(N.mul(B));if(!i&&0>g.cmp(_))t=y.neg(),r=S,i=g.neg(),u=v;else if(i&&2==++A)break;y=g,M=w,w=g,E=S,S=v,k=B,B=R}b=g.neg(),m=v;var P=i.sqr().add(u.sqr());return b.sqr().add(m.sqr()).cmp(P)>=0&&(b=t,m=r),i.negative&&(i=i.neg(),u=u.neg()),b.negative&&(b=b.neg(),m=m.neg()),[{a:i,b:u},{a:b,b:m}]},ShortCurve.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),u=r.b.neg().mul(e).divRound(this.n),b=n.mul(r.a),m=u.mul(i.a),y=n.mul(r.b),g=u.mul(i.b);return{k1:e.sub(b).sub(m),k2:y.add(g).neg()}},ShortCurve.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw Error("invalid point");var u=i.fromRed().isOdd();return(t&&!u||!t&&u)&&(i=i.redNeg()),this.point(e,i)},ShortCurve.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,u=0;u":""},Point.prototype.isInfinity=function(){return this.inf},Point.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Point.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),u=n.redSqr().redISub(this.x.redAdd(this.x)),b=n.redMul(this.x.redSub(u)).redISub(this.y);return this.curve.point(u,b)},Point.prototype.getX=function(){return this.x.fromRed()},Point.prototype.getY=function(){return this.y.fromRed()},Point.prototype.mul=function(e){return(e=new n(e,16),this.isInfinity())?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Point.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Point.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Point.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Point.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,negate=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(negate)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(negate)}}}return t},Point.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},u(JPoint,b.BasePoint),ShortCurve.prototype.jpoint=function(e,t,r){return new JPoint(this,e,t,r)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);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(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),u=this.y.redMul(t.redMul(e.z)),b=e.y.redMul(r.redMul(this.z)),m=i.redSub(n),y=u.redSub(b);if(0===m.cmpn(0))return 0!==y.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var g=m.redSqr(),v=g.redMul(m),_=i.redMul(g),w=y.redSqr().redIAdd(v).redISub(_).redISub(_),M=y.redMul(_.redISub(w)).redISub(u.redMul(v)),S=this.z.redMul(e.z).redMul(m);return this.curve.jpoint(w,M,S)},JPoint.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,u=e.y.redMul(t).redMul(this.z),b=r.redSub(i),m=n.redSub(u);if(0===b.cmpn(0))return 0!==m.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var y=b.redSqr(),g=y.redMul(b),v=r.redMul(y),_=m.redSqr().redIAdd(g).redISub(v).redISub(v),w=m.redMul(v.redISub(_)).redISub(n.redMul(g)),M=this.z.redMul(b);return this.curve.jpoint(_,w,M)},JPoint.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r=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)}},6226:function(e,t,r){"use strict";var i,n=r(7028),u=r(9359),b=r(4401).assert;function PresetCurve(e){"short"===e.type?this.curve=new u.short(e):"edwards"===e.type?this.curve=new u.edwards(e):this.curve=new u.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,b(this.g.validate(),"Invalid curve"),b(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var i=new PresetCurve(r);return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i}),i}})}t.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(9702)}catch(e){i=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},4088:function(e,t,r){"use strict";var i=r(711),n=r(4910),u=r(4401),b=r(6226),m=r(3500),y=u.assert,g=r(4724),v=r(7526);function EC(e){if(!(this instanceof EC))return new EC(e);"string"==typeof e&&(y(b.hasOwnProperty(e),"Unknown curve "+e),e=b[e]),e instanceof b.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=EC,EC.prototype.keyPair=function(e){return new g(this,e)},EC.prototype.keyFromPrivate=function(e,t){return g.fromPrivate(this,e,t)},EC.prototype.keyFromPublic=function(e,t){return g.fromPublic(this,e,t)},EC.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||m(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),u=this.n.sub(new i(2));;){var b=new i(t.generate(r));if(!(b.cmp(u)>0))return b.iaddn(1),this.keyFromPrivate(b)}},EC.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return(r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0)?e.sub(this.n):e},EC.prototype.sign=function(e,t,r,u){"object"==typeof r&&(u=r,r=null),u||(u={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new i(e,16));for(var b=this.n.byteLength(),m=t.getPrivate().toArray("be",b),y=e.toArray("be",b),g=new n({hash:this.hash,entropy:m,nonce:y,pers:u.pers,persEnc:u.persEnc||"utf8"}),_=this.n.sub(new i(1)),w=0;;w++){var M=u.k?u.k(w):new i(g.generate(this.n.byteLength()));if(!(0>=(M=this._truncateToN(M,!0)).cmpn(1)||M.cmp(_)>=0)){var S=this.g.mul(M);if(!S.isInfinity()){var B=S.getX(),E=B.umod(this.n);if(0!==E.cmpn(0)){var k=M.invm(this.n).mul(E.mul(t.getPrivate()).iadd(e));if(0!==(k=k.umod(this.n)).cmpn(0)){var A=(S.getY().isOdd()?1:0)|(0!==B.cmp(E)?2:0);return u.canonical&&k.cmp(this.nh)>0&&(k=this.n.sub(k),A^=1),new v({r:E,s:k,recoveryParam:A})}}}}}},EC.prototype.verify=function(e,t,r,n){e=this._truncateToN(new i(e,16)),r=this.keyFromPublic(r,n);var u=(t=new v(t,"hex")).r,b=t.s;if(0>u.cmpn(1)||u.cmp(this.n)>=0||0>b.cmpn(1)||b.cmp(this.n)>=0)return!1;var m=b.invm(this.n),y=m.mul(e).umod(this.n),g=m.mul(u).umod(this.n);if(!this.curve._maxwellTrick){var _=this.g.mulAdd(y,r.getPublic(),g);return!_.isInfinity()&&0===_.getX().umod(this.n).cmp(u)}var _=this.g.jmulAdd(y,r.getPublic(),g);return!_.isInfinity()&&_.eqXToP(u)},EC.prototype.recoverPubKey=function(e,t,r,n){y((3&r)===r,"The recovery param is more than two bits"),t=new v(t,n);var u=this.n,b=new i(e),m=t.r,g=t.s,_=1&r,w=r>>1;if(m.cmp(this.curve.p.umod(this.curve.n))>=0&&w)throw Error("Unable to find sencond key candinate");m=w?this.curve.pointFromX(m.add(this.curve.n),_):this.curve.pointFromX(m,_);var M=t.r.invm(u),S=u.sub(b).mul(M).umod(u),B=g.mul(M).umod(u);return this.g.mulAdd(S,m,B)},EC.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new v(t,i)).recoveryParam)return t.recoveryParam;for(var n,u=0;u<4;u++){try{n=this.recoverPubKey(e,t,u)}catch(e){continue}if(n.eq(r))return u}throw Error("Unable to find valid recovery factor")}},4724:function(e,t,r){"use strict";var i=r(711),n=r(4401).assert;function KeyPair(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=KeyPair,KeyPair.fromPublic=function(e,t,r){return t instanceof KeyPair?t:new KeyPair(e,{pub:t,pubEnc:r})},KeyPair.fromPrivate=function(e,t,r){return t instanceof KeyPair?t:new KeyPair(e,{priv:t,privEnc:r})},KeyPair.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(e,t){return("string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t)?this.pub.encode(t,e):this.pub},KeyPair.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(e,t){if(e.x||e.y){"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&n(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},KeyPair.prototype.derive=function(e){return e.mul(this.priv).getX()},KeyPair.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},KeyPair.prototype.inspect=function(){return""}},7526:function(e,t,r){"use strict";var i=r(711),n=r(4401),u=n.assert;function Signature(e,t){if(e instanceof Signature)return e;this._importDER(e,t)||(u(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function Position(){this.place=0}function getLength(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,u=0,b=t.place;u>>=0;return!(n<=127)&&(t.place=b,n)}function rmPadding(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}e.exports=Signature,Signature.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new Position;if(48!==e[r.place++])return!1;var u=getLength(e,r);if(!1===u||u+r.place!==e.length||2!==e[r.place++])return!1;var b=getLength(e,r);if(!1===b)return!1;var m=e.slice(r.place,b+r.place);if(r.place+=b,2!==e[r.place++])return!1;var y=getLength(e,r);if(!1===y||e.length!==y+r.place)return!1;var g=e.slice(r.place,y+r.place);if(0===m[0]){if(!(128&m[1]))return!1;m=m.slice(1)}if(0===g[0]){if(!(128&g[1]))return!1;g=g.slice(1)}return this.r=new i(m),this.s=new i(g),this.recoveryParam=null,!0},Signature.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=rmPadding(t),r=rmPadding(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var i=[2];constructLength(i,t.length),(i=i.concat(t)).push(2),constructLength(i,r.length);var u=i.concat(r),b=[48];return constructLength(b,u.length),b=b.concat(u),n.encode(b,e)}},8511:function(e,t,r){"use strict";var i=r(7028),n=r(6226),u=r(4401),b=u.assert,m=u.parseBytes,y=r(9917),g=r(9314);function EDDSA(e){if(b("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);var e=n[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=EDDSA,EDDSA.prototype.sign=function(e,t){e=m(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),u=this.encodePoint(n),b=this.hashInt(u,r.pubBytes(),e).mul(r.priv()),y=i.add(b).umod(this.curve.n);return this.makeSignature({R:n,S:y,Rencoded:u})},EDDSA.prototype.verify=function(e,t,r){e=m(e),t=this.makeSignature(t);var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),u=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(u)},EDDSA.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(n>>1)-1?(n>>1)-y:y,u.isubn(m)):m=0,i[b]=m,u.iushrn(1)}return i}function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i=0,n=0;e.cmpn(-i)>0||t.cmpn(-n)>0;){var u,b,m=e.andln(3)+i&3,y=t.andln(3)+n&3;if(3===m&&(m=-1),3===y&&(y=-1),(1&m)==0)u=0;else{var g=e.andln(7)+i&7;u=(3===g||5===g)&&2===y?-m:m}if(r[0].push(u),(1&y)==0)b=0;else{var g=t.andln(7)+n&7;b=(3===g||5===g)&&2===m?-y:y}r[1].push(b),2*i===u+1&&(i=1-i),2*n===b+1&&(n=1-n),e.iushrn(1),t.iushrn(1)}return r}function cachedProperty(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}}function parseBytes(e){return"string"==typeof e?t.toArray(e,"hex"):e}function intFromLE(e){return new i(e,"hex","le")}t.assert=n,t.toArray=u.toArray,t.zero2=u.zero2,t.toHex=u.toHex,t.encode=u.encode,t.getNAF=getNAF,t.getJSF=getJSF,t.cachedProperty=cachedProperty,t.parseBytes=parseBytes,t.intFromLE=intFromLE},8368:function(e,t,r){var i=r(6911).Buffer,n=r(3533);function EVP_BytesToKey(e,t,r,u){if(i.isBuffer(e)||(e=i.from(e,"binary")),t&&(i.isBuffer(t)||(t=i.from(t,"binary")),8!==t.length))throw RangeError("salt should be Buffer with 8 byte length");for(var b=r/8,m=i.alloc(b),y=i.alloc(u||0),g=i.alloc(0);b>0||u>0;){var v=new n;v.update(g),v.update(e),t&&v.update(t),g=v.digest();var _=0;if(b>0){var w=m.length-b;_=Math.min(b,g.length),g.copy(m,w,0,_),b-=_}if(_0){var M=y.length-u,S=Math.min(u,g.length-_);g.copy(y,M,_,_+S),u-=S}}return g.fill(0),{key:m,iv:y}}e.exports=EVP_BytesToKey},9029:function(e,t,r){"use strict";var i=r(6911).Buffer,n=r(3726).Transform;function throwIfNotStringOrBuffer(e,t){if(!i.isBuffer(e)&&"string"!=typeof e)throw TypeError(t+" must be a string or a buffer")}function HashBase(e){n.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(3782)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(throwIfNotStringOrBuffer(e,"Data"),this._finalized)throw Error("Digest already called");i.isBuffer(e)||(e=i.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var u=this._blockOffset;u0;++b)this._length[b]+=m,(m=this._length[b]/4294967296|0)>0&&(this._length[b]-=4294967296*m);return this},HashBase.prototype._update=function(){throw Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw Error("_digest is not implemented")},e.exports=HashBase},7028:function(e,t,r){t.utils=r(263),t.common=r(1330),t.sha=r(301),t.ripemd=r(3079),t.hmac=r(3092),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160},1330:function(e,t,r){"use strict";var i=r(263),n=r(3523);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=BlockHash,BlockHash.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(u=8,i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0;uthis.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t>>3}function g1_256(e){return i(e,17)^i(e,19)^e>>>10}t.ft_1=ft_1,t.ch32=ch32,t.maj32=maj32,t.p32=p32,t.s0_256=s0_256,t.s1_256=s1_256,t.g0_256=g0_256,t.g1_256=g1_256},263:function(e,t,r){"use strict";var i=r(3523),n=r(3782);function isSurrogatePair(e,t){return(64512&e.charCodeAt(t))==55296&&!(t<0)&&!(t+1>=e.length)&&(64512&e.charCodeAt(t+1))==56320}function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e){if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192:(isSurrogatePair(e,n)?(u=65536+((1023&u)<<10)+(1023&e.charCodeAt(++n)),r[i++]=u>>18|240,r[i++]=u>>12&63|128):r[i++]=u>>12|224,r[i++]=u>>6&63|128),r[i++]=63&u|128)}}else for(n=0;n>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function toHex32(e,t){for(var r="",i=0;i>>0;return m}function split32(e,t){for(var r=Array(4*e.length),i=0,n=0;i>>24,r[n+1]=u>>>16&255,r[n+2]=u>>>8&255,r[n+3]=255&u):(r[n+3]=u>>>24,r[n+2]=u>>>16&255,r[n+1]=u>>>8&255,r[n]=255&u)}return r}function rotr32(e,t){return e>>>t|e<<32-t}function rotl32(e,t){return e<>>32-t}function sum32(e,t){return e+t>>>0}function sum32_3(e,t,r){return e+t+r>>>0}function sum32_4(e,t,r,i){return e+t+r+i>>>0}function sum32_5(e,t,r,i,n){return e+t+r+i+n>>>0}function sum64(e,t,r,i){var n=e[t],u=i+e[t+1]>>>0;e[t]=(u>>0,e[t+1]=u}function sum64_hi(e,t,r,i){return(t+i>>>0>>0}function sum64_lo(e,t,r,i){return t+i>>>0}function sum64_4_hi(e,t,r,i,n,u,b,m){var y,g=t;return e+r+n+b+(0+((g=g+i>>>0)>>0)>>0)>>0}function sum64_4_lo(e,t,r,i,n,u,b,m){return t+i+u+m>>>0}function sum64_5_hi(e,t,r,i,n,u,b,m,y,g){var v,_=t;return e+r+n+b+y+(0+((_=_+i>>>0)>>0)>>0)>>0)>>0}function sum64_5_lo(e,t,r,i,n,u,b,m,y,g){return t+i+u+m+g>>>0}function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0}function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}function shr64_hi(e,t,r){return e>>>r}function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}t.inherits=n,t.toArray=toArray,t.toHex=toHex,t.htonl=htonl,t.toHex32=toHex32,t.zero2=zero2,t.zero8=zero8,t.join32=join32,t.split32=split32,t.rotr32=rotr32,t.rotl32=rotl32,t.sum32=sum32,t.sum32_3=sum32_3,t.sum32_4=sum32_4,t.sum32_5=sum32_5,t.sum64=sum64,t.sum64_hi=sum64_hi,t.sum64_lo=sum64_lo,t.sum64_4_hi=sum64_4_hi,t.sum64_4_lo=sum64_4_lo,t.sum64_5_hi=sum64_5_hi,t.sum64_5_lo=sum64_5_lo,t.rotr64_hi=rotr64_hi,t.rotr64_lo=rotr64_lo,t.shr64_hi=shr64_hi,t.shr64_lo=shr64_lo},4910:function(e,t,r){"use strict";var i=r(7028),n=r(6545),u=r(3523);function HmacDRBG(e){if(!(this instanceof HmacDRBG))return new HmacDRBG(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");u(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=HmacDRBG,HmacDRBG.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},HmacDRBG.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var u=[];u.length>>32-t}function fnF(e,t,r,i,n,u,b){return rotl(e+(t&r|~t&i)+n+u|0,b)+t|0}function fnG(e,t,r,i,n,u,b){return rotl(e+(t&i|r&~i)+n+u|0,b)+t|0}function fnH(e,t,r,i,n,u,b){return rotl(e+(t^r^i)+n+u|0,b)+t|0}function fnI(e,t,r,i,n,u,b){return rotl(e+(r^(t|~i))+n+u|0,b)+t|0}i(MD5,n),MD5.prototype._update=function(){for(var e=0;e<16;++e)b[e]=this._block.readInt32LE(4*e);var t=this._a,r=this._b,i=this._c,n=this._d;t=fnF(t,r,i,n,b[0],3614090360,7),n=fnF(n,t,r,i,b[1],3905402710,12),i=fnF(i,n,t,r,b[2],606105819,17),r=fnF(r,i,n,t,b[3],3250441966,22),t=fnF(t,r,i,n,b[4],4118548399,7),n=fnF(n,t,r,i,b[5],1200080426,12),i=fnF(i,n,t,r,b[6],2821735955,17),r=fnF(r,i,n,t,b[7],4249261313,22),t=fnF(t,r,i,n,b[8],1770035416,7),n=fnF(n,t,r,i,b[9],2336552879,12),i=fnF(i,n,t,r,b[10],4294925233,17),r=fnF(r,i,n,t,b[11],2304563134,22),t=fnF(t,r,i,n,b[12],1804603682,7),n=fnF(n,t,r,i,b[13],4254626195,12),i=fnF(i,n,t,r,b[14],2792965006,17),r=fnF(r,i,n,t,b[15],1236535329,22),t=fnG(t,r,i,n,b[1],4129170786,5),n=fnG(n,t,r,i,b[6],3225465664,9),i=fnG(i,n,t,r,b[11],643717713,14),r=fnG(r,i,n,t,b[0],3921069994,20),t=fnG(t,r,i,n,b[5],3593408605,5),n=fnG(n,t,r,i,b[10],38016083,9),i=fnG(i,n,t,r,b[15],3634488961,14),r=fnG(r,i,n,t,b[4],3889429448,20),t=fnG(t,r,i,n,b[9],568446438,5),n=fnG(n,t,r,i,b[14],3275163606,9),i=fnG(i,n,t,r,b[3],4107603335,14),r=fnG(r,i,n,t,b[8],1163531501,20),t=fnG(t,r,i,n,b[13],2850285829,5),n=fnG(n,t,r,i,b[2],4243563512,9),i=fnG(i,n,t,r,b[7],1735328473,14),r=fnG(r,i,n,t,b[12],2368359562,20),t=fnH(t,r,i,n,b[5],4294588738,4),n=fnH(n,t,r,i,b[8],2272392833,11),i=fnH(i,n,t,r,b[11],1839030562,16),r=fnH(r,i,n,t,b[14],4259657740,23),t=fnH(t,r,i,n,b[1],2763975236,4),n=fnH(n,t,r,i,b[4],1272893353,11),i=fnH(i,n,t,r,b[7],4139469664,16),r=fnH(r,i,n,t,b[10],3200236656,23),t=fnH(t,r,i,n,b[13],681279174,4),n=fnH(n,t,r,i,b[0],3936430074,11),i=fnH(i,n,t,r,b[3],3572445317,16),r=fnH(r,i,n,t,b[6],76029189,23),t=fnH(t,r,i,n,b[9],3654602809,4),n=fnH(n,t,r,i,b[12],3873151461,11),i=fnH(i,n,t,r,b[15],530742520,16),r=fnH(r,i,n,t,b[2],3299628645,23),t=fnI(t,r,i,n,b[0],4096336452,6),n=fnI(n,t,r,i,b[7],1126891415,10),i=fnI(i,n,t,r,b[14],2878612391,15),r=fnI(r,i,n,t,b[5],4237533241,21),t=fnI(t,r,i,n,b[12],1700485571,6),n=fnI(n,t,r,i,b[3],2399980690,10),i=fnI(i,n,t,r,b[10],4293915773,15),r=fnI(r,i,n,t,b[1],2240044497,21),t=fnI(t,r,i,n,b[8],1873313359,6),n=fnI(n,t,r,i,b[15],4264355552,10),i=fnI(i,n,t,r,b[6],2734768916,15),r=fnI(r,i,n,t,b[13],1309151649,21),t=fnI(t,r,i,n,b[4],4149444226,6),n=fnI(n,t,r,i,b[11],3174756917,10),i=fnI(i,n,t,r,b[2],718787259,15),r=fnI(r,i,n,t,b[9],3951481745,21),this._a=this._a+t|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+n|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=u.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},1354:function(e,t,r){var i=r(711),n=r(3500);function MillerRabin(e){this.rand=e||new n.Rand}e.exports=MillerRabin,MillerRabin.create=function(e){return new MillerRabin(e)},MillerRabin.prototype._randbelow=function(e){var t=Math.ceil(e.bitLength()/8);do var r=new i(this.rand.generate(t));while(r.cmp(e)>=0);return r},MillerRabin.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},MillerRabin.prototype.test=function(e,t,r){var n=e.bitLength(),u=i.mont(e),b=new i(1).toRed(u);t||(t=Math.max(1,n/48|0));for(var m=e.subn(1),y=0;!m.testn(y);y++);for(var g=e.shrn(y),v=m.toRed(u);t>0;t--){var _=this._randrange(new i(2),m);r&&r(_);var w=_.toRed(u).redPow(g);if(0!==w.cmp(b)&&0!==w.cmp(v)){for(var M=1;M0;t--){var v=this._randrange(new i(2),b),_=e.gcd(v);if(0!==_.cmpn(1))return _;var w=v.toRed(n).redPow(y);if(0!==w.cmp(u)&&0!==w.cmp(g)){for(var M=1;M>8,b=255&n;u?r.push(u,b):r.push(b)}return r}function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r1073741823||t!=t)throw TypeError("Bad key length")}},2127:function(e,t,r){var i={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},n=r(4873),u=r(6911).Buffer,b=r(5349),m=r(7007),y=r(5407);function pbkdf2(e,t,r,g,v){b(r,g),e=y(e,m,"Password"),t=y(t,m,"Salt"),v=v||"sha1";var _=u.allocUnsafe(g),w=u.allocUnsafe(t.length+4);t.copy(w,0,0,t.length);for(var M=0,S=i[v],B=Math.ceil(g/S),E=1;E<=B;E++){w.writeUInt32BE(E,t.length);for(var k=n(v,e).update(w).digest(),A=k,N=1;N=t.length){u++;break}var b=t.slice(2,n-1);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&u++,b.length<8&&u++,u)throw Error("decryption error");return t.slice(n)}function compare(e,t){e=v.from(e),t=v.from(t);var r=0,i=e.length;e.length!==t.length&&(r++,i=Math.min(e.length,t.length));for(var n=-1;++n_||new b(t).cmp(y.modulus)>=0)throw Error("decryption error");u=r?g(new b(t),y):m(t,y);var w=v.alloc(_-u.length);if(u=v.concat([w,u],_),4===n)return oaep(y,u);if(1===n)return pkcs1(y,u,r);if(3===n)return u;throw Error("unknown padding")}},3995:function(e,t,r){var i=r(9902),n=r(7223),u=r(9739),b=r(5520),m=r(6386),y=r(711),g=r(1607),v=r(7166),_=r(6911).Buffer;function oaep(e,t){var r=e.modulus.byteLength(),i=t.length,g=u("sha1").update(_.alloc(0)).digest(),v=g.length,w=2*v;if(i>r-w-2)throw Error("message too long");var M=_.alloc(r-i-w-2),S=r-v-1,B=n(v),E=m(_.concat([g,M,_.alloc(1,1),t],S),b(B,S)),k=m(B,b(E,v));return new y(_.concat([_.alloc(1),k,E],r))}function pkcs1(e,t,r){var i,n=t.length,u=e.modulus.byteLength();if(n>u-11)throw Error("message too long");return i=r?_.alloc(u-n-3,255):nonZero(u-n-3),new y(_.concat([_.from([0,r?1:2]),i,_.alloc(1),t],u))}function nonZero(e){for(var t,r=_.allocUnsafe(e),i=0,u=n(2*e),b=0;i=0)throw Error("data too long for modulus")}else throw Error("unknown padding");return r?v(u,b):g(u,b)}},1607:function(e,t,r){var i=r(711),n=r(6911).Buffer;function withPublic(e,t){return n.from(e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed().toArray())}e.exports=withPublic},6386:function(e){e.exports=function(e,t){for(var r=e.length,i=-1;++i4294967295)throw RangeError("requested too many random bytes");var r=u.allocUnsafe(e);if(e>0){if(e>65536)for(var i=0;i4294967295||e<0)throw TypeError("offset must be a uint32");if(e>m||e>t)throw RangeError("offset out of range")}function assertSize(e,t,r){if("number"!=typeof e||e!=e)throw TypeError("size must be a number");if(e>4294967295||e<0)throw TypeError("size must be a uint32");if(e+t>r||e>m)throw RangeError("buffer too small")}function randomFill(e,t,i,n){if(!b.isBuffer(e)&&!(e instanceof r.g.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)n=t,t=0,i=e.length;else if("function"==typeof i)n=i,i=e.length-t;else if("function"!=typeof n)throw TypeError('"cb" argument must be a function');return assertOffset(t,e.length),assertSize(i,t,e.length),actualFill(e,t,i,n)}function actualFill(e,t,r,i){var u=e.buffer,b=new Uint8Array(u,t,r);if(y.getRandomValues(b),i){n.nextTick(function(){i(null,e)});return}return e}function randomFillSync(e,t,i){if(void 0===t&&(t=0),!b.isBuffer(e)&&!(e instanceof r.g.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');return assertOffset(t,e.length),void 0===i&&(i=e.length-t),assertSize(i,t,e.length),actualFill(e,t,i)}y&&y.getRandomValues?(t.randomFill=randomFill,t.randomFillSync=randomFillSync):(t.randomFill=oldBrowser,t.randomFillSync=oldBrowser)},4646:function(e){"use strict";let t={};function createErrorType(e,r,i){function getMessage(e,t,i){return"string"==typeof r?r:r(e,t,i)}i||(i=Error);let NodeError=class NodeError extends i{constructor(e,t,r){super(getMessage(e,t,r))}};NodeError.prototype.name=i.name,NodeError.prototype.code=e,t[e]=NodeError}function oneOf(e,t){if(!Array.isArray(e))return`of ${t} ${String(e)}`;{let r=e.length;return(e=e.map(e=>String(e)),r>2)?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:2===r?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}}function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}createErrorType("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),createErrorType("ERR_INVALID_ARG_TYPE",function(e,t,r){let i,n;if("string"==typeof t&&startsWith(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be",endsWith(e," argument"))n=`The ${e} ${i} ${oneOf(t,"type")}`;else{let r=includes(e,".")?"property":"argument";n=`The "${e}" ${r} ${i} ${oneOf(t,"type")}`}return n+`. Received type ${typeof r}`},TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},2403:function(e,t,r){"use strict";var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var u=r(1709),b=r(7337);r(3782)(Duplex,u);for(var m=i(b.prototype),y=0;y0){if("string"==typeof t||m.objectMode||Object.getPrototypeOf(t)===_.prototype||(t=_uint8ArrayToBuffer(t)),i)m.endEmitted?x(e,new P):addChunk(e,m,t,!0);else if(m.ended)x(e,new N);else{if(m.destroyed)return!1;m.reading=!1,m.decoder&&!r?(t=m.decoder.write(t),m.objectMode||0!==t.length?addChunk(e,m,t,!1):maybeReadMore(e,m)):addChunk(e,m,t,!1)}}else i||(m.reading=!1,maybeReadMore(e,m));return!m.ended&&(m.length=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function howMuchToRead(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function onEofChunk(e,t){if(b("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}}function emitReadable(e){var t=e._readableState;b("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(b("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;b("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){b("readable nexttick read 0"),e.read(0)}function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}function resume_(e,t){b("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(b("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function endReadable(e){var t=e._readableState;b("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(b("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,i=e.length;r=r.highWaterMark:r.length>0)||r.ended))return b("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,r))&&r.ended)return 0===r.length&&endReadable(this),null;var n=r.needReadable;return b("need readable",n),(0===r.length||r.length-e0?fromList(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),i!==e&&r.ended&&endReadable(this)),null!==t&&this.emit("data",t),t},Readable.prototype._read=function(e){x(this,new R("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,b("pipe count=%d opts=%j",i.pipesCount,t);var u=t&&!1===t.end||e===n.stdout||e===n.stderr?unpipe:onend;function onunpipe(e,t){b("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,cleanup())}function onend(){b("onend"),e.end()}i.endEmitted?n.nextTick(u):r.once("end",u),e.on("unpipe",onunpipe);var m=pipeOnDrain(r);e.on("drain",m);var y=!1;function cleanup(){b("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",m),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),y=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&m()}function ondata(t){b("ondata");var n=e.write(t);b("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==indexOf(i.pipes,e))&&!y&&(b("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function onerror(t){b("onerror",t),unpipe(),e.removeListener("error",onerror),0===a(e,"error")&&x(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){b("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){b("unpipe"),r.unpipe(e)}return r.on("data",ondata),prependListener(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),i.flowing||(b("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var u=0;u0,!1!==i.flowing&&this.resume()):"readable"!==e||i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,b("on readable",i.length,i.reading),i.length?emitReadable(this):i.reading||n.nextTick(nReadingNextTick,this)),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=v.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=v.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(b("resume"),e.flowing=!e.readableListening,resume(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",function(){if(b("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(n){b("wrapped data"),r.decoder&&(n=r.decoder.write(n)),(!r.objectMode||null!=n)&&(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))}),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var u=0;u-1))throw new P(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new B("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var i=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||endWritable(this,i,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=_.destroy,Writable.prototype._undestroy=_.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},6871:function(e,t,r){"use strict";function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i,u=r(9698),b=Symbol("lastResolve"),m=Symbol("lastReject"),y=Symbol("error"),g=Symbol("ended"),v=Symbol("lastPromise"),_=Symbol("handlePromise"),w=Symbol("stream");function createIterResult(e,t){return{value:e,done:t}}function readAndResolve(e){var t=e[b];if(null!==t){var r=e[w].read();null!==r&&(e[v]=null,e[b]=null,e[m]=null,t(createIterResult(r,!1)))}}function onReadable(e){n.nextTick(readAndResolve,e)}function wrapForNext(e,t){return function(r,i){e.then(function(){if(t[g]){r(createIterResult(void 0,!0));return}t[_](r,i)},i)}}var M=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((_defineProperty(i={get stream(){return this[w]},next:function(){var e,t=this,r=this[y];if(null!==r)return Promise.reject(r);if(this[g])return Promise.resolve(createIterResult(void 0,!0));if(this[w].destroyed)return new Promise(function(e,r){n.nextTick(function(){t[y]?r(t[y]):e(createIterResult(void 0,!0))})});var i=this[v];if(i)e=new Promise(wrapForNext(i,this));else{var u=this[w].read();if(null!==u)return Promise.resolve(createIterResult(u,!1));e=new Promise(this[_])}return this[v]=e,e}},Symbol.asyncIterator,function(){return this}),_defineProperty(i,"return",function(){var e=this;return new Promise(function(t,r){e[w].destroy(null,function(e){if(e){r(e);return}t(createIterResult(void 0,!0))})})}),i),M);e.exports=function(e){var t,r=Object.create(S,(_defineProperty(t={},w,{value:e,writable:!0}),_defineProperty(t,b,{value:null,writable:!0}),_defineProperty(t,m,{value:null,writable:!0}),_defineProperty(t,y,{value:null,writable:!0}),_defineProperty(t,g,{value:e._readableState.endEmitted,writable:!0}),_defineProperty(t,_,{value:function(e,t){var i=r[w].read();i?(r[v]=null,r[b]=null,r[m]=null,e(createIterResult(i,!1))):(r[b]=e,r[m]=t)},writable:!0}),t));return r[v]=null,u(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[m];null!==t&&(r[v]=null,r[b]=null,r[m]=null,t(e)),r[y]=e;return}var i=r[b];null!==i&&(r[v]=null,r[b]=null,r[m]=null,i(createIterResult(void 0,!0))),r[g]=!0}),e.on("readable",onReadable.bind(null,r)),r}},4379:function(e,t,r){"use strict";function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function _objectSpread(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t=i.allocUnsafe(e>>>0),r=this.head,n=0;r;)copyBuffer(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return en.length?n.length:e;if(u===n.length?i+=n:i+=n.slice(0,e),0==(e-=u)){u===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(u));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var u=r.data,b=e>u.length?u.length:e;if(u.copy(t,t.length-e,0,b),0==(e-=b)){b===u.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=u.slice(b));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return n(this,_objectSpread({},t,{depth:0,customInspect:!1}))}}]),BufferList}()},7025:function(e){"use strict";function destroy(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return i||u?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(emitErrorNT,this,e)):n.nextTick(emitErrorNT,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,n.nextTick(emitErrorAndCloseNT,r,e)):n.nextTick(emitErrorAndCloseNT,r,e):t?(n.nextTick(emitCloseNT,r),t(e)):n.nextTick(emitCloseNT,r)})),this}function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){(!e._writableState||e._writableState.emitClose)&&(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(e,t){e.emit("error",t)}function errorOrDestroy(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}e.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy}},9698:function(e,t,r){"use strict";var i=r(4646).q.ERR_STREAM_PREMATURE_CLOSE;function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=Array(r),n=0;n0,function(t){e||(e=t),t&&b.forEach(call),u||(b.forEach(call),n(e))})});return r.reduce(pipe)}e.exports=pipeline},6776:function(e,t,r){"use strict";var i=r(4646).q.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function getHighWaterMark(e,t,r,n){var u=highWaterMarkFrom(t,n,r);if(null!=u){if(!(isFinite(u)&&Math.floor(u)===u)||u<0)throw new i(n?r:"highWaterMark",u);return Math.floor(u)}return e.objectMode?16:16384}e.exports={getHighWaterMark:getHighWaterMark}},4678:function(e,t,r){e.exports=r(2781)},3726:function(e,t,r){var i=r(2781);"disable"===n.env.READABLE_STREAM&&i?(e.exports=i.Readable,Object.assign(e.exports,i),e.exports.Stream=i):((t=e.exports=r(1709)).Stream=i||t,t.Readable=t,t.Writable=r(7337),t.Duplex=r(2403),t.Transform=r(1170),t.PassThrough=r(7889),t.finished=r(9698),t.pipeline=r(8442))},3225:function(e,t,r){"use strict";var i=r(4300).Buffer,n=r(3782),u=r(9029),b=Array(16),m=[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],y=[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],g=[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],v=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];function RIPEMD160(){u.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}n(RIPEMD160,u),RIPEMD160.prototype._update=function(){for(var e,t,r,i,n,u,_,w,M,S,B,E,k,A,N,R,P,x,I,C,D,T,j,O,H,q,L,z,U,F,W,V,G,Z,J,X,Y,$,Q,ee,et,er,ei,en,ea,eo,es,ef,eh,ed,ec,eu,el,ep,eb,em,ey,eg,ev,e_,ew,eM,eS,eB,eE,ek,eA,eN,eR,eP,ex,eI,eC=0;eC<16;++eC)b[eC]=this._block.readInt32LE(4*eC);for(var eD=0|this._a,eT=0|this._b,ej=0|this._c,eO=0|this._d,eH=0|this._e,eq=0|this._a,eL=0|this._b,ez=0|this._c,eK=0|this._d,eU=0|this._e,eF=0;eF<80;eF+=1)eF<16?(e=eD,t=eT,r=ej,i=eO,n=eH,ex=rotl(e+(t^r^i)+b[m[eF]]+0|0,g[eF])+n|0,w=eq,M=eL,S=ez,B=eK,E=eU,eI=rotl(w+(M^(S|~B))+b[y[eF]]+1352829926|0,v[eF])+E|0):eF<32?(N=eD,R=eT,P=ej,x=eO,I=eH,ex=rotl(N+(R&P|~R&x)+b[m[eF]]+1518500249|0,g[eF])+I|0,T=eq,j=eL,O=ez,H=eK,q=eU,eI=rotl(T+(j&H|O&~H)+b[y[eF]]+1548603684|0,v[eF])+q|0):eF<48?(U=eD,F=eT,W=ej,V=eO,G=eH,ex=rotl(U+((F|~W)^V)+b[m[eF]]+1859775393|0,g[eF])+G|0,X=eq,Y=eL,$=ez,Q=eK,ee=eU,eI=rotl(X+((Y|~$)^Q)+b[y[eF]]+1836072691|0,v[eF])+ee|0):eF<64?(ei=eD,en=eT,ea=ej,eo=eO,es=eH,ex=rotl(ei+(en&eo|ea&~eo)+b[m[eF]]+2400959708|0,g[eF])+es|0,ed=eq,ec=eL,eu=ez,el=eK,ep=eU,eI=rotl(ed+(ec&eu|~ec&el)+b[y[eF]]+2053994217|0,v[eF])+ep|0):(ey=eD,eg=eT,ev=ej,e_=eO,ew=eH,ex=rotl(ey+(eg^(ev|~e_))+b[m[eF]]+2840853838|0,g[eF])+ew|0,eB=eq,eE=eL,ek=ez,eA=eK,eN=eU,eI=rotl(eB+(eE^ek^eA)+b[y[eF]]+0|0,v[eF])+eN|0),eD=eH,eH=eO,eO=rotl(ej,10),ej=eT,eT=ex,eq=eU,eU=eK,eK=rotl(ez,10),ez=eL,eL=eI;var eW=this._b+ej+eK|0;this._b=this._c+eO+eU|0,this._c=this._d+eH+eq|0,this._d=this._e+eD+eL|0,this._e=this._a+eT+ez|0,this._a=eW},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=i.alloc?i.alloc(20):new i(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=RIPEMD160},5055:function(e,t,r){var i=r(4300),n=i.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(copyProps(i,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i.SlowBuffer(e)}},6911:function(e,t,r){/*! safe-buffer. MIT License. Feross Aboukhadijeh */var i=r(4300),n=i.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(copyProps(i,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i.SlowBuffer(e)}},2858:function(e,t,r){var i=r(6911).Buffer;function Hash(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var r=this._block,n=this._blockSize,u=e.length,b=this._len,m=0;m=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 u=this._hash();return e?u.toString(e):u},Hash.prototype._update=function(){throw Error("_update must be implemented by subclass")},e.exports=Hash},4371:function(e,t,r){var i=e.exports=function(e){var t=i[e=e.toLowerCase()];if(!t)throw Error(e+" is not supported (we accept pull requests)");return new t};i.sha=r(4018),i.sha1=r(4179),i.sha224=r(532),i.sha256=r(1843),i.sha384=r(7455),i.sha512=r(9934)},4018:function(e,t,r){var i=r(3782),n=r(2858),u=r(6911).Buffer,b=[1518500249,1859775393,-1894007588,-899497514],m=Array(80);function Sha(){this.init(),this._w=m,n.call(this,64,56)}function rotl5(e){return e<<5|e>>>27}function rotl30(e){return e<<30|e>>>2}function ft(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(Sha,n),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(e){for(var t=this._w,r=0|this._a,i=0|this._b,n=0|this._c,u=0|this._d,m=0|this._e,y=0;y<16;++y)t[y]=e.readInt32BE(4*y);for(;y<80;++y)t[y]=t[y-3]^t[y-8]^t[y-14]^t[y-16];for(var g=0;g<80;++g){var v=~~(g/20),_=rotl5(r)+ft(v,i,n,u)+m+t[g]+b[v]|0;m=u,u=n,n=rotl30(i),i=r,r=_}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=u+this._d|0,this._e=m+this._e|0},Sha.prototype._hash=function(){var e=u.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=Sha},4179:function(e,t,r){var i=r(3782),n=r(2858),u=r(6911).Buffer,b=[1518500249,1859775393,-1894007588,-899497514],m=Array(80);function Sha1(){this.init(),this._w=m,n.call(this,64,56)}function rotl1(e){return e<<1|e>>>31}function rotl5(e){return e<<5|e>>>27}function rotl30(e){return e<<30|e>>>2}function ft(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(Sha1,n),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(e){for(var t=this._w,r=0|this._a,i=0|this._b,n=0|this._c,u=0|this._d,m=0|this._e,y=0;y<16;++y)t[y]=e.readInt32BE(4*y);for(;y<80;++y)t[y]=rotl1(t[y-3]^t[y-8]^t[y-14]^t[y-16]);for(var g=0;g<80;++g){var v=~~(g/20),_=rotl5(r)+ft(v,i,n,u)+m+t[g]+b[v]|0;m=u,u=n,n=rotl30(i),i=r,r=_}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=u+this._d|0,this._e=m+this._e|0},Sha1.prototype._hash=function(){var e=u.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=Sha1},532:function(e,t,r){var i=r(3782),n=r(1843),u=r(2858),b=r(6911).Buffer,m=Array(64);function Sha224(){this.init(),this._w=m,u.call(this,64,56)}i(Sha224,n),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 e=b.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=Sha224},1843:function(e,t,r){var i=r(3782),n=r(2858),u=r(6911).Buffer,b=[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],m=Array(64);function Sha256(){this.init(),this._w=m,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function gamma1(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}i(Sha256,n),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(e){for(var t=this._w,r=0|this._a,i=0|this._b,n=0|this._c,u=0|this._d,m=0|this._e,y=0|this._f,g=0|this._g,v=0|this._h,_=0;_<16;++_)t[_]=e.readInt32BE(4*_);for(;_<64;++_)t[_]=gamma1(t[_-2])+t[_-7]+gamma0(t[_-15])+t[_-16]|0;for(var w=0;w<64;++w){var M=v+sigma1(m)+ch(m,y,g)+b[w]+t[w]|0,S=sigma0(r)+maj(r,i,n)|0;v=g,g=y,y=m,m=u+M|0,u=n,n=i,i=r,r=M+S|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=u+this._d|0,this._e=m+this._e|0,this._f=y+this._f|0,this._g=g+this._g|0,this._h=v+this._h|0},Sha256.prototype._hash=function(){var e=u.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},7455:function(e,t,r){var i=r(3782),n=r(9934),u=r(2858),b=r(6911).Buffer,m=Array(160);function Sha384(){this.init(),this._w=m,u.call(this,128,112)}i(Sha384,n),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 e=b.allocUnsafe(48);function writeInt64BE(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),e},e.exports=Sha384},9934:function(e,t,r){var i=r(3782),n=r(2858),u=r(6911).Buffer,b=[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],m=Array(160);function Sha512(){this.init(),this._w=m,n.call(this,128,112)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}i(Sha512,n),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,u=0|this._dh,m=0|this._eh,y=0|this._fh,g=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,M=0|this._cl,S=0|this._dl,B=0|this._el,E=0|this._fl,k=0|this._gl,A=0|this._hl,N=0;N<32;N+=2)t[N]=e.readInt32BE(4*N),t[N+1]=e.readInt32BE(4*N+4);for(;N<160;N+=2){var R=t[N-30],P=t[N-30+1],x=Gamma0(R,P),I=Gamma0l(P,R),C=Gamma1(R=t[N-4],P=t[N-4+1]),D=Gamma1l(P,R),T=t[N-14],j=t[N-14+1],O=t[N-32],H=t[N-32+1],q=I+j|0,L=x+T+getCarry(q,I)|0;L=(L=L+C+getCarry(q=q+D|0,D)|0)+O+getCarry(q=q+H|0,H)|0,t[N]=L,t[N+1]=q}for(var z=0;z<160;z+=2){L=t[z],q=t[z+1];var U,F,W,V,G,Z,J,X,Y,$,Q=(U=r)&(F=i)|n&(U|F),ee=(W=_)&(V=w)|M&(W|V),et=sigma0(r,_),er=sigma0(_,r),ei=sigma1(m,B),en=sigma1(B,m),ea=b[z],eo=b[z+1],es=(G=m,Z=y,(J=g)^G&(Z^J)),ef=(X=B,Y=E,($=k)^X&(Y^$)),eh=A+en|0,ed=v+ei+getCarry(eh,A)|0;ed=(ed=(ed=ed+es+getCarry(eh=eh+ef|0,ef)|0)+ea+getCarry(eh=eh+eo|0,eo)|0)+L+getCarry(eh=eh+q|0,q)|0;var ec=er+ee|0,eu=et+Q+getCarry(ec,er)|0;v=g,A=k,g=y,k=E,y=m,E=B,m=u+ed+getCarry(B=S+eh|0,S)|0,u=n,S=M,n=i,M=w,i=r,w=_,r=ed+eu+getCarry(_=eh+ec|0,eh)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+M|0,this._dl=this._dl+S|0,this._el=this._el+B|0,this._fl=this._fl+E|0,this._gl=this._gl+k|0,this._hl=this._hl+A|0,this._ah=this._ah+r+getCarry(this._al,_)|0,this._bh=this._bh+i+getCarry(this._bl,w)|0,this._ch=this._ch+n+getCarry(this._cl,M)|0,this._dh=this._dh+u+getCarry(this._dl,S)|0,this._eh=this._eh+m+getCarry(this._el,B)|0,this._fh=this._fh+y+getCarry(this._fl,E)|0,this._gh=this._gh+g+getCarry(this._gl,k)|0,this._hh=this._hh+v+getCarry(this._hl,A)|0},Sha512.prototype._hash=function(){var e=u.allocUnsafe(64);function writeInt64BE(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},3704:function(e,t,r){"use strict";var i=r(5055).Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function normalizeEncoding(e){var t=_normalizeEncoding(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw Error("Unknown encoding: "+e);return t||e}function StringDecoder(e){var t;switch(this.encoding=normalizeEncoding(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8CheckIncomplete(e,t,r){var i=t.length-1;if(i=0?(n>0&&(e.lastNeed=n-1),n):--i=0?(n>0&&(e.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:e.lastNeed=n-3),n):0}function utf8CheckExtraBytes(e,t,r){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function utf8Text(e,t){var r=utf8CheckIncomplete(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function utf8End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.s=StringDecoder,StringDecoder.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r