(this["webpackJsonpharvest-ui"]=this["webpackJsonpharvest-ui"]||[]).push([[59],{1770:function(t,e,r){"use strict";r.d(e,"a",(function(){return T}));let i=!1,n=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,h=null;const a=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var u,l;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(u||(u={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(l||(l={}));const f="0123456789abcdef";class d{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",t),s>o[r]||console.log.apply(console,e)}debug(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this._log(d.levels.DEBUG,e)}info(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this._log(d.levels.INFO,e)}warn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this._log(d.levels.WARNING,e)}makeError(t,e,r){if(n)return this.makeError("censored error",e,{});e||(e=d.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=f[e[t]>>4],r+=f[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(h){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code=".concat(e)),i.push("version=".concat(this.version));const o=t;let s="";switch(e){case l.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case l.CALL_EXCEPTION:case l.INSUFFICIENT_FUNDS:case l.MISSING_NEW:case l.NONCE_EXPIRED:case l.REPLACEMENT_UNDERPRICED:case l.TRANSACTION_REPLACED:case l.UNPREDICTABLE_GAS_LIMIT:s=e}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const h=new Error(t);return h.reason=o,h.code=e,Object.keys(r).forEach((function(t){h[t]=r[t]})),h}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,d.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),a&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:a})}checkSafeUint53(t,e){"number"===typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,d.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,d.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return h||(h=new d("logger/5.7.0")),h}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),i){if(!t)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}n=!!t,i=!!e}static setLogLevel(t){const e=o[t.toLowerCase()];null!=e?s=e:d.globalLogger().warn("invalid log level - "+t)}static from(t){return new d(t)}}d.errors=l,d.levels=u;const c=new d("bytes/5.7.0");function m(t){return!!t.toHexString}function p(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return p(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function g(t){return"number"===typeof t&&t==t&&t%1===0}function v(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"===typeof t)return!1;if(!g(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!g(r)||r<0||r>=256)return!1}return!0}function y(t,e){if(e||(e={}),"number"===typeof t){c.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),p(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"===typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),m(t)&&(t=t.toHexString()),M(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":c.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return p(new Uint8Array(i))}return v(t)?p(new Uint8Array(t)):c.throwArgumentError("invalid arrayify value","value",t)}function M(t,e){return!("string"!==typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}var w=r(925);var b=r.n(w).a.BN;new d("bignumber/5.7.0");var S=r(98),A=r.n(S);function E(t){return"0x"+A.a.keccak_256(y(t))}new d("rlp/5.7.0");const _=new d("address/5.7.0");function N(t){M(t,20)||_.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);const i=y(E(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(15&i[n>>1])>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const R={};for(let k=0;k<10;k++)R[String(k)]=String(k);for(let k=0;k<26;k++)R[String.fromCharCode(65+k)]=String(10+k);const I=Math.floor((P=9007199254740991,Math.log10?Math.log10(P):Math.log(P)/Math.LN10));var P;function x(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>R[t]).join("");for(;e.length>=I;){let t=e.substring(0,I);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function C(t){let e=null;if("string"!==typeof t&&_.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=N(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&_.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==x(t)&&_.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new b(r,36).toString(16);e.length<40;)e="0"+e;e=N("0x"+e)}else _.throwArgumentError("invalid address","address",t);var r;return e}function T(t){if(function(t){let e=null;try{e=JSON.parse(t)}catch(r){return!1}return e.encseed&&e.ethaddr}(t))try{return C(JSON.parse(t).ethaddr)}catch(e){return null}if(function(t){let r=null;try{r=JSON.parse(t)}catch(e){return!1}return!(!r.version||parseInt(r.version)!==r.version||3!==parseInt(r.version))}(t))try{return C(JSON.parse(t).address)}catch(e){return null}return null}},235:function(t,e,r){"use strict";r.d(e,"b",(function(){return Pt})),r.d(e,"a",(function(){return xt})),r.d(e,"g",(function(){return Ct})),r.d(e,"f",(function(){return Tt})),r.d(e,"c",(function(){return kt})),r.d(e,"e",(function(){return Ot})),r.d(e,"d",(function(){return Dt}));let i=!1,n=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,h=null;const a=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var u,l;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(u||(u={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(l||(l={}));const f="0123456789abcdef";class d{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",t),s>o[r]||console.log.apply(console,e)}debug(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this._log(d.levels.DEBUG,e)}info(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this._log(d.levels.INFO,e)}warn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];this._log(d.levels.WARNING,e)}makeError(t,e,r){if(n)return this.makeError("censored error",e,{});e||(e=d.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=f[e[t]>>4],r+=f[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(h){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code=".concat(e)),i.push("version=".concat(this.version));const o=t;let s="";switch(e){case l.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case l.CALL_EXCEPTION:case l.INSUFFICIENT_FUNDS:case l.MISSING_NEW:case l.NONCE_EXPIRED:case l.REPLACEMENT_UNDERPRICED:case l.TRANSACTION_REPLACED:case l.UNPREDICTABLE_GAS_LIMIT:s=e}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const h=new Error(t);return h.reason=o,h.code=e,Object.keys(r).forEach((function(t){h[t]=r[t]})),h}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,d.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),a&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:a})}checkSafeUint53(t,e){"number"===typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,d.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,d.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return h||(h=new d("logger/5.7.0")),h}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),i){if(!t)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}n=!!t,i=!!e}static setLogLevel(t){const e=o[t.toLowerCase()];null!=e?s=e:d.globalLogger().warn("invalid log level - "+t)}static from(t){return new d(t)}}d.errors=l,d.levels=u;const c=new d("bytes/5.7.0");function m(t){return!!t.toHexString}function p(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return p(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function g(t){return b(t)&&!(t.length%2)||y(t)}function v(t){return"number"===typeof t&&t==t&&t%1===0}function y(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"===typeof t)return!1;if(!v(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!v(r)||r<0||r>=256)return!1}return!0}function M(t,e){if(e||(e={}),"number"===typeof t){c.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),p(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"===typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),m(t)&&(t=t.toHexString()),b(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":c.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return p(new Uint8Array(i))}return y(t)?p(new Uint8Array(t)):c.throwArgumentError("invalid arrayify value","value",t)}function w(t){const e=t.map(t=>M(t)),r=e.reduce((t,e)=>t+e.length,0),i=new Uint8Array(r);return e.reduce((t,e)=>(i.set(e,t),t+e.length),0),p(i)}function b(t,e){return!("string"!==typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function S(t,e){if(e||(e={}),"number"===typeof t){c.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"===typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"===typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),m(t))return t.toHexString();if(b(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":c.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(y(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return c.throwArgumentError("invalid hexlify value","value",t)}function A(t){if("string"!==typeof t)t=S(t);else if(!b(t)||t.length%2)return null;return(t.length-2)/2}function E(t,e,r){return"string"!==typeof t?t=S(t):(!b(t)||t.length%2)&&c.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function _(t,e){for("string"!==typeof t?t=S(t):b(t)||c.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&c.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function N(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(g(t)){let r=M(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=S(r.slice(0,32)),e.s=S(r.slice(32,64))):65===r.length?(e.r=S(r.slice(0,32)),e.s=S(r.slice(32,64)),e.v=r[64]):c.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:c.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=S(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=M(t)).length>e&&c.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),p(r)}(M(e._vs),32);e._vs=S(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&c.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=S(r);null==e.s?e.s=n:e.s!==n&&c.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?c.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&c.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&b(e.r)?e.r=_(e.r,32):c.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&b(e.s)?e.s=_(e.s,32):c.throwArgumentError("signature missing or invalid s","signature",t);const r=M(e.s);r[0]>=128&&c.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=S(r);e._vs&&(b(e._vs)||c.throwArgumentError("signature invalid _vs","signature",t),e._vs=_(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&c.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}new d("properties/5.7.0");function R(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}class I{constructor(t){R(this,"alphabet",t),R(this,"base",t.length),R(this,"_alphabetMap",{}),R(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=M(t);if(0===e.length)return"";let r=[0];for(let n=0;n<e.length;++n){let t=e[n];for(let e=0;e<r.length;++e)t+=r[e]<<8,r[e]=t%this.base,t=t/this.base|0;for(;t>0;)r.push(t%this.base),t=t/this.base|0}let i="";for(let n=0;0===e[n]&&n<e.length-1;++n)i+=this._leader;for(let n=r.length-1;n>=0;--n)i+=this.alphabet[r[n]];return i}decode(t){if("string"!==typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r<t.length;r++){let i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");let n=i;for(let t=0;t<e.length;++t)n+=e[t]*this.base,e[t]=255&n,n>>=8;for(;n>0;)e.push(255&n),n>>=8}for(let r=0;t[r]===this._leader&&r<t.length-1;++r)e.push(0);return M(new Uint8Array(e.reverse()))}}new I("abcdefghijklmnopqrstuvwxyz234567");const P=new I("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var x=r(49);var C=r.n(x).a.BN;const T=new d("bignumber/5.7.0"),k={};let O=!1;class D{constructor(t,e){t!==k&&T.throwError("cannot call constructor directly; use BigNumber.from",d.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return L(U(this).fromTwos(t))}toTwos(t){return L(U(this).toTwos(t))}abs(){return"-"===this._hex[0]?D.from(this._hex.substring(1)):this}add(t){return L(U(this).add(U(t)))}sub(t){return L(U(this).sub(U(t)))}div(t){return D.from(t).isZero()&&B("division-by-zero","div"),L(U(this).div(U(t)))}mul(t){return L(U(this).mul(U(t)))}mod(t){const e=U(t);return e.isNeg()&&B("division-by-zero","mod"),L(U(this).umod(e))}pow(t){const e=U(t);return e.isNeg()&&B("negative-power","pow"),L(U(this).pow(e))}and(t){const e=U(t);return(this.isNegative()||e.isNeg())&&B("unbound-bitwise-result","and"),L(U(this).and(e))}or(t){const e=U(t);return(this.isNegative()||e.isNeg())&&B("unbound-bitwise-result","or"),L(U(this).or(e))}xor(t){const e=U(t);return(this.isNegative()||e.isNeg())&&B("unbound-bitwise-result","xor"),L(U(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&B("negative-width","mask"),L(U(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&B("negative-width","shl"),L(U(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&B("negative-width","shr"),L(U(this).shrn(t))}eq(t){return U(this).eq(U(t))}lt(t){return U(this).lt(U(t))}lte(t){return U(this).lte(U(t))}gt(t){return U(this).gt(U(t))}gte(t){return U(this).gte(U(t))}isNegative(){return"-"===this._hex[0]}isZero(){return U(this).isZero()}toNumber(){try{return U(this).toNumber()}catch(t){B("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return T.throwError("this platform does not support BigInt",d.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?O||(O=!0,T.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?T.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",d.errors.UNEXPECTED_ARGUMENT,{}):T.throwError("BigNumber.toString does not accept parameters",d.errors.UNEXPECTED_ARGUMENT,{})),U(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof D)return t;if("string"===typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new D(k,F(t)):t.match(/^-?[0-9]+$/)?new D(k,F(new C(t))):T.throwArgumentError("invalid BigNumber string","value",t);if("number"===typeof t)return t%1&&B("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&B("overflow","BigNumber.from",t),D.from(String(t));const e=t;if("bigint"===typeof e)return D.from(e.toString());if(y(e))return D.from(S(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"===typeof t)return D.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"===typeof t&&(b(t)||"-"===t[0]&&b(t.substring(1))))return D.from(t)}return T.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function F(t){if("string"!==typeof t)return F(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&T.throwArgumentError("invalid hex","value",t),"0x00"===(t=F(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function L(t){return D.from(F(t))}function U(t){const e=D.from(t).toHexString();return"-"===e[0]?new C("-"+e.substring(3),16):new C(e.substring(2),16)}function B(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),T.throwError(t,d.errors.NUMERIC_FAULT,i)}const q=new d("strings/5.7.0");var G,z;function W(t,e,r,i,n){if(t===z.BAD_PREFIX||t===z.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6===2;i++)t++;return t}return t===z.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(G||(G={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(z||(z={}));Object.freeze({error:function(t,e,r,i,n){return q.throwArgumentError("invalid codepoint at offset ".concat(e,"; ").concat(t),"bytes",r)},ignore:W,replace:function(t,e,r,i,n){return t===z.OVERLONG?(i.push(n),0):(i.push(65533),W(t,e,r))}});function K(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G.current;e!=G.current&&(q.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){const e=t.charCodeAt(i);if(e<128)r.push(e);else if(e<2048)r.push(e>>6|192),r.push(63&e|128);else if(55296==(64512&e)){i++;const n=t.charCodeAt(i);if(i>=t.length||56320!==(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&e)<<10)+(1023&n);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(e>>12|224),r.push(e>>6&63|128),r.push(63&e|128)}return M(r)}var H,j=r(28),V=r.n(j);!function(t){t.sha256="sha256",t.sha512="sha512"}(H||(H={}));const Z=new d("sha2/5.7.0");function J(t){return"0x"+V.a.sha256().update(M(t)).digest("hex")}function X(t,e,r){return H[t]||Z.throwError("unsupported algorithm "+t,d.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+V.a.hmac(V.a[t],M(e)).update(M(r)).digest("hex")}var Y=r(918);const $=new d("signing-key/5.7.0");let Q=null;function tt(){return Q||(Q=new Y.a("secp256k1")),Q}class et{constructor(t){R(this,"curve","secp256k1"),R(this,"privateKey",S(t)),32!==A(this.privateKey)&&$.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=tt().keyFromPrivate(M(this.privateKey));R(this,"publicKey","0x"+e.getPublic(!1,"hex")),R(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),R(this,"_isSigningKey",!0)}_addPoint(t){const e=tt().keyFromPublic(M(this.publicKey)),r=tt().keyFromPublic(M(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=tt().keyFromPrivate(M(this.privateKey)),r=M(t);32!==r.length&&$.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return N({recoveryParam:i.recoveryParam,r:_("0x"+i.r.toString(16),32),s:_("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=tt().keyFromPrivate(M(this.privateKey)),r=tt().keyFromPublic(M(rt(t)));return _("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function rt(t,e){const r=M(t);if(32===r.length){const t=new et(r);return e?"0x"+tt().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?S(r):"0x"+tt().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+tt().keyFromPublic(r).getPublic(!0,"hex"):S(r):$.throwArgumentError("invalid public or private key","key","[REDACTED]")}var it=r(98),nt=r.n(it);function ot(t){return"0x"+nt.a.keccak_256(M(t))}new d("rlp/5.7.0");const st=new d("address/5.7.0");function ht(t){b(t,20)||st.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);const i=M(ot(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(15&i[n>>1])>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const at={};for(let Ft=0;Ft<10;Ft++)at[String(Ft)]=String(Ft);for(let Ft=0;Ft<26;Ft++)at[String.fromCharCode(65+Ft)]=String(10+Ft);const ut=Math.floor((lt=9007199254740991,Math.log10?Math.log10(lt):Math.log(lt)/Math.LN10));var lt;function ft(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>at[t]).join("");for(;e.length>=ut;){let t=e.substring(0,ut);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function dt(t){let e=null;if("string"!==typeof t&&st.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=ht(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&st.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==ft(t)&&st.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new C(r,36).toString(16);e.length<40;)e="0"+e;e=ht("0x"+e)}else st.throwArgumentError("invalid address","address",t);var r;return e}new d("transactions/5.7.0");var ct;!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(ct||(ct={}));function mt(t){return dt(E(ot(E(rt(t),1)),12))}const pt=new d("wordlists/5.7.0");class gt{constructor(t){pt.checkAbstract(new.target,gt),R(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const i=t.getWord(r);if(r!==t.getWordIndex(i))return"0x";e.push(i)}return ot(K(e.join("\n")+"\n"))}static register(t,e){e||(e=t.locale)}}let vt=null;function yt(t){if(null==vt&&(vt="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==gt.check(t)))throw vt=null,new Error("BIP39 Wordlist for en (English) FAILED")}const Mt=new class extends gt{constructor(){super("en")}getWord(t){return yt(this),vt[t]}getWordIndex(t){return yt(this),vt.indexOf(t)}};gt.register(Mt);const wt={en:Mt},bt=new d("hdnode/5.5.0"),St=D.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),At=K("Bitcoin seed");function Et(t){return(1<<t)-1<<8-t}function _t(t){return _(S(t),32)}function Nt(t){return P.encode(w([t,E(J(J(t)),0,4)]))}function Rt(t){if(null==t)return wt.en;if("string"===typeof t){const e=wt[t];return null==e&&bt.throwArgumentError("unknown locale","wordlist",t),e}return t}const It={},Pt="m/44'/60'/0'/0/0";class xt{constructor(t,e,r,i,n,o,s,h){if(bt.checkNew(new.target,xt),t!==It)throw new Error("HDNode constructor cannot be called directly");if(e){const t=new et(e);R(this,"privateKey",t.privateKey),R(this,"publicKey",t.compressedPublicKey)}else R(this,"privateKey",null),R(this,"publicKey",S(r));var a;R(this,"parentFingerprint",i),R(this,"fingerprint",E((a=J(this.publicKey),"0x"+V.a.ripemd160().update(M(a)).digest("hex")),0,4)),R(this,"address",mt(this.publicKey)),R(this,"chainCode",n),R(this,"index",o),R(this,"depth",s),null==h?(R(this,"mnemonic",null),R(this,"path",null)):"string"===typeof h?(R(this,"mnemonic",null),R(this,"path",h)):(R(this,"mnemonic",h),R(this,"path",h.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return Nt(w([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",S(this.depth),this.parentFingerprint,_(S(this.index),4),this.chainCode,null!=this.privateKey?w(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new xt(It,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(2147483647&t));const r=new Uint8Array(37);if(2147483648&t){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(M(this.privateKey),1),e&&(e+="'")}else r.set(M(this.publicKey));for(let l=24;l>=0;l-=8)r[33+(l>>3)]=t>>24-l&255;const i=M(X(H.sha512,this.chainCode,r)),n=i.slice(0,32),o=i.slice(32);let s=null,h=null;if(this.privateKey)s=_t(D.from(n).add(this.privateKey).mod(St));else{h=new et(S(n))._addPoint(this.publicKey)}let a=e;const u=this.mnemonic;return u&&(a=Object.freeze({phrase:u.phrase,path:e,locale:u.locale||"en"})),new xt(It,s,h,this.fingerprint,_t(o),t,this.depth+1,a)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let r=this;for(let i=0;i<e.length;i++){const t=e[i];if(t.match(/^[0-9]+'$/)){const e=parseInt(t.substring(0,t.length-1));if(e>=2147483648)throw new Error("invalid path index - "+t);r=r._derive(2147483648+e)}else{if(!t.match(/^[0-9]+$/))throw new Error("invalid path component - "+t);{const e=parseInt(t);if(e>=2147483648)throw new Error("invalid path index - "+t);r=r._derive(e)}}}return r}static _fromSeed(t,e){const r=M(t);if(r.length<16||r.length>64)throw new Error("invalid seed");const i=M(X(H.sha512,At,r));return new xt(It,_t(i.slice(0,32)),null,"0x00000000",_t(i.slice(32)),0,0,e)}static fromMnemonic(t,e,r){return t=kt(Tt(t,r=Rt(r)),r),xt._fromSeed(Ct(t,e),{phrase:t,path:"m",locale:r.locale})}static fromSeed(t){return xt._fromSeed(t,null)}static fromExtendedKey(t){const e=P.decode(t);82===e.length&&Nt(e.slice(0,78))===t||bt.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=e[4],i=S(e.slice(5,9)),n=parseInt(S(e.slice(9,13)).substring(2),16),o=S(e.slice(13,45)),s=e.slice(45,78);switch(S(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new xt(It,null,S(s),i,o,n,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new xt(It,S(s.slice(1)),null,i,o,n,r,null)}return bt.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function Ct(t,e){e||(e="");const r=K("mnemonic"+e,G.NFKD);return function(t,e,r,i,n){let o;t=M(t),e=M(e);let s=1;const h=new Uint8Array(i),a=new Uint8Array(e.length+4);let u,l;a.set(e);for(let f=1;f<=s;f++){a[e.length]=f>>24&255,a[e.length+1]=f>>16&255,a[e.length+2]=f>>8&255,a[e.length+3]=255&f;let d=M(X(n,t,a));o||(o=d.length,l=new Uint8Array(o),s=Math.ceil(i/o),u=i-(s-1)*o),l.set(d);for(let e=1;e<r;e++){d=M(X(n,t,d));for(let t=0;t<o;t++)l[t]^=d[t]}const c=(f-1)*o,m=f===s?u:o;h.set(M(l).slice(0,m),c)}return S(h)}(K(t,G.NFKD),r,2048,64,"sha512")}function Tt(t,e){e=Rt(e),bt.checkNormalize();const r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");const i=M(new Uint8Array(Math.ceil(11*r.length/8)));let n=0;for(let h=0;h<r.length;h++){let t=e.getWordIndex(r[h].normalize("NFKD"));if(-1===t)throw new Error("invalid mnemonic");for(let e=0;e<11;e++)t&1<<10-e&&(i[n>>3]|=1<<7-n%8),n++}const o=32*r.length/3,s=Et(r.length/3);if((M(J(i.slice(0,o/8)))[0]&s)!==(i[i.length-1]&s))throw new Error("invalid checksum");return S(i.slice(0,o/8))}function kt(t,e){if(e=Rt(e),(t=M(t)).length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");const r=[0];let i=11;for(let s=0;s<t.length;s++)i>8?(r[r.length-1]<<=8,r[r.length-1]|=t[s],i-=8):(r[r.length-1]<<=i,r[r.length-1]|=t[s]>>8-i,r.push(t[s]&(1<<8-i)-1),i+=3);const n=t.length/4,o=M(J(t))[0]&Et(n);return r[r.length-1]<<=n,r[r.length-1]|=o>>8-n,e.join(r.map(t=>e.getWord(t)))}function Ot(t,e){try{return Tt(t,e),!0}catch(r){}return!1}function Dt(t){return("number"!==typeof t||t<0||t>=2147483648||t%1)&&bt.throwArgumentError("invalid account index","index",t),"m/44'/60'/".concat(t,"'/0/0")}},49:function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(1415).Buffer}catch(I){}function h(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function a(t,e,r){var i=h(t,r);return r-1>=e&&(i|=h(t,r-1)<<4),i}function u(t,e,r,n){for(var o=0,s=0,h=Math.min(t.length,r),a=e;a<h;a++){var u=t.charCodeAt(a)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&s<n,"Invalid character"),o+=s}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(i("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===r)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===r)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2===0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,h=Math.min(o,o-s)+r,a=0,l=r;l<h;l+=i)a=u(t,l,l+i,e),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(I){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],a=(16777215&(h<<n|o)).toString(16);o=h>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==o||s!==this.length-1?d[6-a.length]+a+r:a+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=c[t],l=m[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(l).toString(t);r=(f=f.idivn(l)).isZero()?p+r:d[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,h=67108863&s,a=s/67108864|0;r.words[0]=h;for(var u=1;u<i;u++){for(var l=a>>>26,f=67108863&a,d=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);c<=d;c++){var m=u-c|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[c])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,a=0|l}return 0!==a?r.words[u]=0|a:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return i(0===(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return i(0===(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return i(0===(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"===typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},o.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var i,n,o,s=t.words,h=e.words,a=r.words,u=0,l=0|s[0],f=8191&l,d=l>>>13,c=0|s[1],m=8191&c,p=c>>>13,g=0|s[2],v=8191&g,y=g>>>13,M=0|s[3],w=8191&M,b=M>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],N=8191&_,R=_>>>13,I=0|s[6],P=8191&I,x=I>>>13,C=0|s[7],T=8191&C,k=C>>>13,O=0|s[8],D=8191&O,F=O>>>13,L=0|s[9],U=8191&L,B=L>>>13,q=0|h[0],G=8191&q,z=q>>>13,W=0|h[1],K=8191&W,H=W>>>13,j=0|h[2],V=8191&j,Z=j>>>13,J=0|h[3],X=8191&J,Y=J>>>13,$=0|h[4],Q=8191&$,tt=$>>>13,et=0|h[5],rt=8191&et,it=et>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],at=8191&ht,ut=ht>>>13,lt=0|h[8],ft=8191&lt,dt=lt>>>13,ct=0|h[9],mt=8191&ct,pt=ct>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,G))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(d,G)|0))<<13)|0;u=((o=Math.imul(d,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,G),n=(n=Math.imul(m,z))+Math.imul(p,G)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,G),n=(n=Math.imul(v,z))+Math.imul(y,G)|0,o=Math.imul(y,z),i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var yt=(u+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,Z)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,Z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,G),n=(n=Math.imul(w,z))+Math.imul(b,G)|0,o=Math.imul(b,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,Z)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,Z)|0;var Mt=(u+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(A,G),n=(n=Math.imul(A,z))+Math.imul(E,G)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,Z)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,Z)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,Y)|0;var wt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,z))+Math.imul(R,G)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,Z)|0,i=i+Math.imul(v,X)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(P,G),n=(n=Math.imul(P,z))+Math.imul(x,G)|0,o=Math.imul(x,z),i=i+Math.imul(N,K)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,Z)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var St=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,st)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(T,G),n=(n=Math.imul(T,z))+Math.imul(k,G)|0,o=Math.imul(k,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,Z)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var At=(u+(i=i+Math.imul(f,at)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(d,at)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,z))+Math.imul(F,G)|0,o=Math.imul(F,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,Z)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,at)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,at)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,z))+Math.imul(B,G)|0,o=Math.imul(B,z),i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,Z)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,at)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var _t=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,K),n=(n=Math.imul(U,H))+Math.imul(B,K)|0,o=Math.imul(B,H),i=i+Math.imul(D,V)|0,n=(n=n+Math.imul(D,Z)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,Z)|0,i=i+Math.imul(T,X)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(b,at)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,dt)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,dt)|0;var Nt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(B,V)|0,o=Math.imul(B,Z),i=i+Math.imul(D,X)|0,n=(n=n+Math.imul(D,Y)|0)+Math.imul(F,X)|0,o=o+Math.imul(F,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,at)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,ft)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,X),n=(n=Math.imul(U,Y))+Math.imul(B,X)|0,o=Math.imul(B,Y),i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(R,at)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,ft)|0,n=(n=n+Math.imul(A,dt)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,dt)|0;var It=(u+(i=i+Math.imul(w,mt)|0)|0)+((8191&(n=(n=n+Math.imul(w,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(B,Q)|0,o=Math.imul(B,tt),i=i+Math.imul(D,rt)|0,n=(n=n+Math.imul(D,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,at)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(N,ft)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,dt)|0;var Pt=(u+(i=i+Math.imul(A,mt)|0)|0)+((8191&(n=(n=n+Math.imul(A,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(B,rt)|0,o=Math.imul(B,it),i=i+Math.imul(D,ot)|0,n=(n=n+Math.imul(D,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(T,at)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(k,at)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,st))+Math.imul(B,ot)|0,o=Math.imul(B,st),i=i+Math.imul(D,at)|0,n=(n=n+Math.imul(D,ut)|0)+Math.imul(F,at)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(T,ft)|0,n=(n=n+Math.imul(T,dt)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,dt)|0;var Ct=(u+(i=i+Math.imul(P,mt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(U,at),n=(n=Math.imul(U,ut))+Math.imul(B,at)|0,o=Math.imul(B,ut),i=i+Math.imul(D,ft)|0,n=(n=n+Math.imul(D,dt)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,dt)|0;var Tt=(u+(i=i+Math.imul(T,mt)|0)|0)+((8191&(n=(n=n+Math.imul(T,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ft),n=(n=Math.imul(U,dt))+Math.imul(B,ft)|0,o=Math.imul(B,dt);var kt=(u+(i=i+Math.imul(D,mt)|0)|0)+((8191&(n=(n=n+Math.imul(D,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863;var Ot=(u+(i=Math.imul(U,mt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(B,mt)|0))<<13)|0;return u=((o=Math.imul(B,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a[0]=gt,a[1]=vt,a[2]=yt,a[3]=Mt,a[4]=wt,a[5]=bt,a[6]=St,a[7]=At,a[8]=Et,a[9]=_t,a[10]=Nt,a[11]=Rt,a[12]=It,a[13]=Pt,a[14]=xt,a[15]=Ct,a[16]=Tt,a[17]=kt,a[18]=Ot,0!==u&&(a[19]=u,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var h=67108863&i,a=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=a;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),d=67108863&f;h=67108863&(d=d+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}r.words[o]=h,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function M(t,e){this.x=t,this.y=e}Math.imul||(g=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?p(this,t,e):r<1024?v(this,t,e):y(this,t,e)},M.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},M.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},M.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},M.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,a=Math.cos(2*Math.PI/h),u=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=a,d=u,c=0;c<s;c++){var m=r[l+c],p=i[l+c],g=r[l+c+s],v=i[l+c+s],y=f*g-d*v;v=f*v+d*g,g=y,r[l+c]=m+g,i[l+c]=p+v,r[l+c+s]=m-g,i[l+c+s]=p-v,c!==h&&(y=a*f-u*d,d=a*d+u*f,f=y)}},M.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},M.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},M.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},M.prototype.convert13b=function(t,e,r,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)r[s]=0;i(0===o),i(0===(-8192&o))},M.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},M.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),h=new Array(i),a=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),d=r.words;d.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,h,a,i,n),this.transform(u,o,l,f,i,n);for(var c=0;c<i;c++){var m=h[c]*l[c]-a[c]*f[c];a[c]=h[c]*f[c]+a[c]*l[c],h[c]=m}return this.conjugate(h,a,i),this.transform(h,a,d,o,i,n),this.conjugate(d,o,i),this.normalize13b(d,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),i("number"===typeof t),i(t<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(t){i("number"===typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var h=this.words[e]&o,a=(0|this.words[e])-h<<r;this.words[e]=a|s,s=h>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},o.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var n;i("number"===typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,a=r;if(n-=s,n=Math.max(0,n),a){for(var u=0;u<s;u++)a.words[u]=this.words[u];a.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&h}return a&&0!==l&&(a.words[a.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(t){i("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return i("number"===typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"===typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var n,o,s=t.length+r;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+r])+h;var a=(0|t.words[n])*e;h=((o-=67108863&a)>>26)-(a/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)h=(o=(0|this.words[n+r])+h)>>26,this.words[n+r]=67108863&o;if(0===h)return this._strip();for(i(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var h,a=i.length-n.length;if("mod"!==e){(h=new o(null)).length=a+1,h.words=new Array(h.length);for(var u=0;u<h.length;u++)h.words[u]=0}var l=i.clone()._ishlnsubmul(n,1,a);0===l.negative&&(i=l,h&&(h.words[a]=1));for(var f=a-1;f>=0;f--){var d=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(d=Math.min(d/s|0,67108863),i._ishlnsubmul(n,d,f);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);h&&(h.words[f]=d)}return h&&h._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:h||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,e),"mod"!==e&&(n=h.div.neg()),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),e),"mod"!==e&&(n=h.div.neg()),{div:n,mod:h.mod}):0!==(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),e),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),h=new o(0),a=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,c=1;0===(e.words[0]&c)&&d<26;++d,c<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var m=0,p=1;0===(r.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(h.isOdd()||a.isOdd())&&(h.iadd(l),a.isub(f)),h.iushrn(1),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(h),s.isub(a)):(r.isub(e),h.isub(n),a.isub(s))}return{a:h,b:a,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),h=new o(0),a=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0===(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);for(var f=0,d=1;0===(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(a),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(h)):(r.isub(e),h.isub(s))}return(n=0===e.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"===typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,s=r;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new N(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function R(t){N.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(S,b),S.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(A,b),n(E,b),n(_,b),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new A;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},N.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},N.prototype._verify2=function(t,e){i(0===(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},N.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},N.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},N.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},N.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},N.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},N.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},N.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},N.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},N.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},N.prototype.isqr=function(t){return this.imul(t,t.clone())},N.prototype.sqr=function(t){return this.mul(t,t)},N.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var h=new o(1).toRed(this),a=h.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(a);)l.redIAdd(a);for(var f=this.pow(l,n),d=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),m=s;0!==c.cmp(h);){for(var p=c,g=0;0!==p.cmp(h);g++)p=p.redSqr();i(g<m);var v=this.pow(f,new o(1).iushln(m-g-1));d=d.redMul(v),f=v.redSqr(),c=c.redMul(f),m=g}return d},N.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},N.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],s=0,h=0,a=e.bitLength()%26;for(0===a&&(a=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=a-1;l>=0;l--){var f=u>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===i&&0===l)&&(n=this.mul(n,r[s]),h=0,s=0)):h=0}a=26}return n},N.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},N.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new R(t)},n(R,N),R.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},R.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},R.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},R.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},R.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(88)(t))},918:function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return z}));var i=r(49),n=r.n(i),o=r(28),s=r.n(o);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof t||"undefined"!==typeof self&&self;function h(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===e||null===e)&&r.path)}},r.exports),r.exports}var a=u;function u(t,e){if(!t)throw new Error(e||"Assertion failed")}u.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var l=h((function(t,e){var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!==typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),o=n>>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}})),f=h((function(t,e){var r=e;r.assert=a,r.toArray=l.toArray,r.zero2=l.zero2,r.toHex=l.toHex,r.encode=l.encode,r.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<i.length;s++){var h,a=o.andln(n-1);o.isOdd()?(h=a>(n>>1)-1?(n>>1)-a:a,o.isubn(h)):h=0,i[s]=h,o.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,h,a=t.andln(3)+n&3,u=e.andln(3)+o&3;3===a&&(a=-1),3===u&&(u=-1),s=0===(1&a)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?a:-a,r[0].push(s),h=0===(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==a?u:-u,r[1].push(h),2*n===s+1&&(n=1-n),2*o===h+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(t){return"string"===typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new n.a(t,"hex","le")}})),d=f.getNAF,c=f.getJSF,m=f.assert;function p(t,e){this.type=t,this.p=new n.a(e.p,16),this.red=e.prime?n.a.red(e.prime):n.a.mont(this.p),this.zero=new n.a(0).toRed(this.red),this.one=new n.a(1).toRed(this.red),this.two=new n.a(2).toRed(this.red),this.n=e.n&&new n.a(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var g=p;function v(t,e){this.curve=t,this.type=e,this.precomputed=null}p.prototype.point=function(){throw new Error("Not implemented")},p.prototype.validate=function(){throw new Error("Not implemented")},p.prototype._fixedNafMul=function(t,e){m(t.precomputed);var r=t._getDoubles(),i=d(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2===0?2:1);n/=3;var o,s,h=[];for(o=0;o<i.length;o+=r.step){s=0;for(var a=o+r.step-1;a>=o;a--)s=(s<<1)+i[a];h.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=n;f>0;f--){for(o=0;o<h.length;o++)(s=h[o])===f?l=l.mixedAdd(r.points[o]):s===-f&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},p.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=d(e,r,this._bitLength),s=this.jpoint(null,null,null),h=o.length-1;h>=0;h--){for(var a=0;h>=0&&0===o[h];h--)a++;if(h>=0&&a++,s=s.dblp(a),h<0)break;var u=o[h];m(0!==u),s="affine"===t.type?u>0?s.mixedAdd(n[u-1>>1]):s.mixedAdd(n[-u-1>>1].neg()):u>0?s.add(n[u-1>>1]):s.add(n[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},p.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,h,a=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o<i;o++){var m=(h=e[o])._getNAFPoints(t);a[o]=m.wnd,u[o]=m.points}for(o=i-1;o>=1;o-=2){var p=o-1,g=o;if(1===a[p]&&1===a[g]){var v=[e[p],null,null,e[g]];0===e[p].y.cmp(e[g].y)?(v[1]=e[p].add(e[g]),v[2]=e[p].toJ().mixedAdd(e[g].neg())):0===e[p].y.cmp(e[g].y.redNeg())?(v[1]=e[p].toJ().mixedAdd(e[g]),v[2]=e[p].add(e[g].neg())):(v[1]=e[p].toJ().mixedAdd(e[g]),v[2]=e[p].toJ().mixedAdd(e[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],M=c(r[p],r[g]);for(f=Math.max(M[0].length,f),l[p]=new Array(f),l[g]=new Array(f),s=0;s<f;s++){var w=0|M[0][s],b=0|M[1][s];l[p][s]=y[3*(w+1)+(b+1)],l[g][s]=0,u[p]=v}}else l[p]=d(r[p],a[p],this._bitLength),l[g]=d(r[g],a[g],this._bitLength),f=Math.max(l[p].length,f),f=Math.max(l[g].length,f)}var S=this.jpoint(null,null,null),A=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s<i;s++)A[s]=0|l[s][o],0!==A[s]&&(_=!1);if(!_)break;E++,o--}if(o>=0&&E++,S=S.dblp(E),o<0)break;for(s=0;s<i;s++){var N=A[s];0!==N&&(N>0?h=u[s][N-1>>1]:N<0&&(h=u[s][-N-1>>1].neg()),S="affine"===h.type?S.mixedAdd(h):S.add(h))}}for(o=0;o<i;o++)u[o]=null;return n?S:S.toP()},p.BasePoint=v,v.prototype.eq=function(){throw new Error("Not implemented")},v.prototype.validate=function(){return this.curve.validate(this)},p.prototype.decodePoint=function(t,e){t=f.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1===2*r)return 6===t[0]?m(t[t.length-1]%2===0):7===t[0]&&m(t[t.length-1]%2===1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},v.prototype.encodeCompressed=function(t){return this.encode(t,!0)},v.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},v.prototype.encode=function(t,e){return f.encode(this._encode(e),t)},v.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},v.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},v.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var o=0;o<t;o++)i=i.dbl();r.push(i)}return{step:t,points:r}},v.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},v.prototype._getBeta=function(){return null},v.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var y=h((function(t){"function"===typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),M=f.assert;function w(t){g.call(this,"short",t),this.a=new n.a(t.a,16).toRed(this.red),this.b=new n.a(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}y(w,g);var b=w;function S(t,e,r,i){g.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n.a(e,16),this.y=new n.a(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 A(t,e,r,i){g.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n.a(0)):(this.x=new n.a(e,16),this.y=new n.a(r,16),this.z=new n.a(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}w.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n.a(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n.a(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],M(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n.a(t.a,16),b:new n.a(t.b,16)}})):this._getEndoBasis(r)}}},w.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.a.mont(t),r=new n.a(2).toRed(e).redInvm(),i=r.redNeg(),o=new n.a(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(o).fromRed(),i.redSub(o).fromRed()]},w.prototype._getEndoBasis=function(t){for(var e,r,i,o,s,h,a,u,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,c=this.n.clone(),m=new n.a(1),p=new n.a(0),g=new n.a(0),v=new n.a(1),y=0;0!==d.cmpn(0);){var M=c.div(d);u=c.sub(M.mul(d)),l=g.sub(M.mul(m));var w=v.sub(M.mul(p));if(!i&&u.cmp(f)<0)e=a.neg(),r=m,i=u.neg(),o=l;else if(i&&2===++y)break;a=u,c=d,d=u,g=m,m=l,v=p,p=w}s=u.neg(),h=l;var b=i.sqr().add(o.sqr());return s.sqr().add(h.sqr()).cmp(b)>=0&&(s=e,h=r),i.negative&&(i=i.neg(),o=o.neg()),s.negative&&(s=s.neg(),h=h.neg()),[{a:i,b:o},{a:s,b:h}]},w.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),h=o.mul(i.a),a=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(h),k2:a.add(u).neg()}},w.prototype.pointFromX=function(t,e){(t=new n.a(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=i.fromRed().isOdd();return(e&&!o||!e&&o)&&(i=i.redNeg()),this.point(t,i)},w.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},w.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),h=t[o],a=h._getBeta();s.k1.negative&&(s.k1.ineg(),h=h.neg(!0)),s.k2.negative&&(s.k2.ineg(),a=a.neg(!0)),i[2*o]=h,i[2*o+1]=a,n[2*o]=s.k1,n[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,i,n,2*o,r),l=0;l<2*o;l++)i[l]=null,n[l]=null;return u},y(S,g.BasePoint),w.prototype.point=function(t,e,r){return new S(this,t,e,r)},w.prototype.pointFromJSON=function(t,e){return S.fromJSON(this,t,e)},S.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},S.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},S.fromJSON=function(t,e,r){"string"===typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},S.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},S.prototype.isInfinity=function(){return this.inf},S.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},S.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},S.prototype.getX=function(){return this.x.fromRed()},S.prototype.getY=function(){return this.y.fromRed()},S.prototype.mul=function(t){return t=new n.a(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},S.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},S.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},S.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},S.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},S.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},y(A,g.BasePoint),w.prototype.jpoint=function(t,e,r){return new A(this,t,e,r)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),h=i.redSub(n),a=o.redSub(s);if(0===h.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=h.redSqr(),l=u.redMul(h),f=i.redMul(u),d=a.redSqr().redIAdd(l).redISub(f).redISub(f),c=a.redMul(f.redISub(d)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(h);return this.curve.jpoint(d,c,m)},A.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),h=n.redSub(o);if(0===s.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var a=s.redSqr(),u=a.redMul(s),l=r.redMul(a),f=h.redSqr().redIAdd(u).redISub(l).redISub(l),d=h.redMul(l.redISub(f)).redISub(n.redMul(u)),c=this.z.redMul(s);return this.curve.jpoint(f,d,c)},A.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,s=this.y,h=this.z,a=h.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),f=u.redSqr(),d=f.redSqr(),c=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(a)),m=o.redMul(f),p=c.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),v=c.redMul(g);v=v.redIAdd(v).redISub(d);var y=u.redMul(h);e+1<t&&(a=a.redMul(d)),o=p,h=y,u=v}return this.curve.jpoint(o,u.redMul(n),h)},A.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},A.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var h=i.redAdd(i).redIAdd(i),a=h.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=a,e=h.redMul(s.redISub(a)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),c=this.x.redAdd(f).redSqr().redISub(l).redISub(d);c=c.redIAdd(c);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(c).redISub(c),e=m.redMul(c.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},A.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var h=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),a=h.redSqr().redISub(s).redISub(s);t=a;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=h.redMul(s.redISub(a)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),d=this.x.redMul(f),c=this.x.redSub(l).redMul(this.x.redAdd(l));c=c.redAdd(c).redIAdd(c);var m=d.redIAdd(d),p=(m=m.redIAdd(m)).redAdd(m);t=c.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=c.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},A.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),h=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),a=e.redAdd(e),u=(a=a.redIAdd(a)).redMul(s),l=h.redSqr().redISub(u.redAdd(u)),f=u.redISub(l),d=s.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var c=h.redMul(f).redISub(d),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,c,m)},A.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),o=n.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(i),h=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),a=i.redIAdd(i);a=(a=(a=a.redIAdd(a)).redIAdd(a)).redIAdd(a);var u=n.redIAdd(s).redSqr().redISub(o).redISub(h).redISub(a),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(h).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.y.redMul(u.redMul(a.redISub(u)).redISub(s.redMul(h)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var c=this.z.redAdd(s).redSqr().redISub(r).redISub(h);return this.curve.jpoint(f,d,c)},A.prototype.mul=function(t,e){return t=new n.a(t,e),this.curve._wnafMul(this,t)},A.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},A.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},A.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},A.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var E=h((function(t,e){var r=e;r.base=g,r.short=b,r.mont=null,r.edwards=null})),_=h((function(t,e){var r,i=e,n=f.assert;function o(t){"short"===t.type?this.curve=new E.short(t):"edwards"===t.type?this.curve=new E.edwards(t):this.curve=new E.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=o,h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s.a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s.a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s.a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s.a.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"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s.a.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"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.a.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(a){r=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s.a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function N(t){if(!(this instanceof N))return new N(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=l.toArray(t.entropy,t.entropyEnc||"hex"),r=l.toArray(t.nonce,t.nonceEnc||"hex"),i=l.toArray(t.pers,t.persEnc||"hex");a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var R=N;N.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},N.prototype._hmac=function(){return new s.a.hmac(this.hash,this.K)},N.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},N.prototype.reseed=function(t,e,r,i){"string"!==typeof e&&(i=r,r=e,e=null),t=l.toArray(t,e),r=l.toArray(r,i),a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},N.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof e&&(i=r,r=e,e=null),r&&(r=l.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var o=n.slice(0,t);return this._update(r),this._reseed++,l.encode(o,e)};var I=f.assert;function P(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var x=P;P.fromPublic=function(t,e,r){return e instanceof P?e:new P(t,{pub:e,pubEnc:r})},P.fromPrivate=function(t,e,r){return e instanceof P?e:new P(t,{priv:e,privEnc:r})},P.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},P.prototype.getPublic=function(t,e){return"string"===typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},P.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},P.prototype._importPrivate=function(t,e){this.priv=new n.a(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},P.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?I(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||I(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},P.prototype.derive=function(t){return t.validate()||I(t.validate(),"public point not validated"),t.mul(this.priv).getX()},P.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},P.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},P.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var C=f.assert;function T(t,e){if(t instanceof T)return t;this._importDER(t,e)||(C(t.r&&t.s,"Signature without r or s"),this.r=new n.a(t.r,16),this.s=new n.a(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var k=T;function O(){this.place=0}function D(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return!(n<=127)&&(e.place=s,n)}function F(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function L(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}T.prototype._importDER=function(t,e){t=f.toArray(t,e);var r=new O;if(48!==t[r.place++])return!1;var i=D(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=D(t,r);if(!1===o)return!1;var s=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var h=D(t,r);if(!1===h)return!1;if(t.length!==h+r.place)return!1;var a=t.slice(r.place,h+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new n.a(s),this.s=new n.a(a),this.recoveryParam=null,!0},T.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=F(e),r=F(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var i=[2];L(i,e.length),(i=i.concat(e)).push(2),L(i,r.length);var n=i.concat(r),o=[48];return L(o,n.length),o=o.concat(n),f.encode(o,t)};var U=function(){throw new Error("unsupported")},B=f.assert;function q(t){if(!(this instanceof q))return new q(t);"string"===typeof t&&(B(Object.prototype.hasOwnProperty.call(_,t),"Unknown curve "+t),t=_[t]),t instanceof _.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var G=q;q.prototype.keyPair=function(t){return new x(this,t)},q.prototype.keyFromPrivate=function(t,e){return x.fromPrivate(this,t,e)},q.prototype.keyFromPublic=function(t,e){return x.fromPublic(this,t,e)},q.prototype.genKeyPair=function(t){t||(t={});for(var e=new R({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||U(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new n.a(2));;){var o=new n.a(e.generate(r));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}},q.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},q.prototype.sign=function(t,e,r,i){"object"===typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n.a(t,16));for(var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),h=t.toArray("be",o),a=new R({hash:this.hash,entropy:s,nonce:h,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new n.a(1)),l=0;;l++){var f=i.k?i.k(l):new n.a(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var c=d.getX(),m=c.umod(this.n);if(0!==m.cmpn(0)){var p=f.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(d.getY().isOdd()?1:0)|(0!==c.cmp(m)?2:0);return i.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new k({r:m,s:p,recoveryParam:g})}}}}}},q.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n.a(t,16)),r=this.keyFromPublic(r,i);var o=(e=new k(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var h,a=s.invm(this.n),u=a.mul(t).umod(this.n),l=a.mul(o).umod(this.n);return this.curve._maxwellTrick?!(h=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&h.eqXToP(o):!(h=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===h.getX().umod(this.n).cmp(o)},q.prototype.recoverPubKey=function(t,e,r,i){B((3&r)===r,"The recovery param is more than two bits"),e=new k(e,i);var o=this.n,s=new n.a(t),h=e.r,a=e.s,u=1&r,l=r>>1;if(h.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");h=l?this.curve.pointFromX(h.add(this.curve.n),u):this.curve.pointFromX(h,u);var f=e.r.invm(o),d=o.sub(s).mul(f).umod(o),c=a.mul(f).umod(o);return this.g.mulAdd(d,h,c)},q.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new k(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var z=h((function(t,e){var r=e;r.version="6.5.4",r.utils=f,r.rand=function(){throw new Error("unsupported")},r.curve=E,r.curves=_,r.ec=G,r.eddsa=null})).ec}).call(this,r(56))},925:function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(1419).Buffer}catch(I){}function h(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function a(t,e,r){var i=h(t,r);return r-1>=e&&(i|=h(t,r-1)<<4),i}function u(t,e,r,n){for(var o=0,s=0,h=Math.min(t.length,r),a=e;a<h;a++){var u=t.charCodeAt(a)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&s<n,"Invalid character"),o+=s}return o}function l(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(i("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===r)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===r)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2===0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,h=Math.min(o,o-s)+r,a=0,l=r;l<h;l+=i)a=u(t,l,l+i,e),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){l(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(I){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],a=(16777215&(h<<n|o)).toString(16);o=h>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==o||s!==this.length-1?d[6-a.length]+a+r:a+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=c[t],l=m[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(l).toString(t);r=(f=f.idivn(l)).isZero()?p+r:d[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,h=67108863&s,a=s/67108864|0;r.words[0]=h;for(var u=1;u<i;u++){for(var l=a>>>26,f=67108863&a,d=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);c<=d;c++){var m=u-c|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[c])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,a=0|l}return 0!==a?r.words[u]=0|a:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return i(0===(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return i(0===(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return i(0===(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"===typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},o.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var i,n,o,s=t.words,h=e.words,a=r.words,u=0,l=0|s[0],f=8191&l,d=l>>>13,c=0|s[1],m=8191&c,p=c>>>13,g=0|s[2],v=8191&g,y=g>>>13,M=0|s[3],w=8191&M,b=M>>>13,S=0|s[4],A=8191&S,E=S>>>13,_=0|s[5],N=8191&_,R=_>>>13,I=0|s[6],P=8191&I,x=I>>>13,C=0|s[7],T=8191&C,k=C>>>13,O=0|s[8],D=8191&O,F=O>>>13,L=0|s[9],U=8191&L,B=L>>>13,q=0|h[0],G=8191&q,z=q>>>13,W=0|h[1],K=8191&W,H=W>>>13,j=0|h[2],V=8191&j,Z=j>>>13,J=0|h[3],X=8191&J,Y=J>>>13,$=0|h[4],Q=8191&$,tt=$>>>13,et=0|h[5],rt=8191&et,it=et>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],at=8191&ht,ut=ht>>>13,lt=0|h[8],ft=8191&lt,dt=lt>>>13,ct=0|h[9],mt=8191&ct,pt=ct>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,G))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(d,G)|0))<<13)|0;u=((o=Math.imul(d,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,G),n=(n=Math.imul(m,z))+Math.imul(p,G)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,G),n=(n=Math.imul(v,z))+Math.imul(y,G)|0,o=Math.imul(y,z),i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var yt=(u+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,Z)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,Z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,G),n=(n=Math.imul(w,z))+Math.imul(b,G)|0,o=Math.imul(b,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,Z)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,Z)|0;var Mt=(u+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(A,G),n=(n=Math.imul(A,z))+Math.imul(E,G)|0,o=Math.imul(E,z),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,Z)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,Z)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,Y)|0;var wt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(N,G),n=(n=Math.imul(N,z))+Math.imul(R,G)|0,o=Math.imul(R,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(w,V)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,Z)|0,i=i+Math.imul(v,X)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(P,G),n=(n=Math.imul(P,z))+Math.imul(x,G)|0,o=Math.imul(x,z),i=i+Math.imul(N,K)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,Z)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var St=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,st)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(T,G),n=(n=Math.imul(T,z))+Math.imul(k,G)|0,o=Math.imul(k,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,H)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,Z)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var At=(u+(i=i+Math.imul(f,at)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(d,at)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,z))+Math.imul(F,G)|0,o=Math.imul(F,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,Z)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,at)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,at)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(U,G),n=(n=Math.imul(U,z))+Math.imul(B,G)|0,o=Math.imul(B,z),i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,Z)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,Z)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,at)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,dt)|0;var _t=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,K),n=(n=Math.imul(U,H))+Math.imul(B,K)|0,o=Math.imul(B,H),i=i+Math.imul(D,V)|0,n=(n=n+Math.imul(D,Z)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,Z)|0,i=i+Math.imul(T,X)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,st)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(b,at)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,dt)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,dt)|0;var Nt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(U,V),n=(n=Math.imul(U,Z))+Math.imul(B,V)|0,o=Math.imul(B,Z),i=i+Math.imul(D,X)|0,n=(n=n+Math.imul(D,Y)|0)+Math.imul(F,X)|0,o=o+Math.imul(F,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(E,at)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(w,ft)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,dt)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(U,X),n=(n=Math.imul(U,Y))+Math.imul(B,X)|0,o=Math.imul(B,Y),i=i+Math.imul(D,Q)|0,n=(n=n+Math.imul(D,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(R,at)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(A,ft)|0,n=(n=n+Math.imul(A,dt)|0)+Math.imul(E,ft)|0,o=o+Math.imul(E,dt)|0;var It=(u+(i=i+Math.imul(w,mt)|0)|0)+((8191&(n=(n=n+Math.imul(w,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,Q),n=(n=Math.imul(U,tt))+Math.imul(B,Q)|0,o=Math.imul(B,tt),i=i+Math.imul(D,rt)|0,n=(n=n+Math.imul(D,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(x,at)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(N,ft)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,dt)|0;var Pt=(u+(i=i+Math.imul(A,mt)|0)|0)+((8191&(n=(n=n+Math.imul(A,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(U,rt),n=(n=Math.imul(U,it))+Math.imul(B,rt)|0,o=Math.imul(B,it),i=i+Math.imul(D,ot)|0,n=(n=n+Math.imul(D,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(T,at)|0,n=(n=n+Math.imul(T,ut)|0)+Math.imul(k,at)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(P,ft)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(U,ot),n=(n=Math.imul(U,st))+Math.imul(B,ot)|0,o=Math.imul(B,st),i=i+Math.imul(D,at)|0,n=(n=n+Math.imul(D,ut)|0)+Math.imul(F,at)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(T,ft)|0,n=(n=n+Math.imul(T,dt)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,dt)|0;var Ct=(u+(i=i+Math.imul(P,mt)|0)|0)+((8191&(n=(n=n+Math.imul(P,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(U,at),n=(n=Math.imul(U,ut))+Math.imul(B,at)|0,o=Math.imul(B,ut),i=i+Math.imul(D,ft)|0,n=(n=n+Math.imul(D,dt)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,dt)|0;var Tt=(u+(i=i+Math.imul(T,mt)|0)|0)+((8191&(n=(n=n+Math.imul(T,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(U,ft),n=(n=Math.imul(U,dt))+Math.imul(B,ft)|0,o=Math.imul(B,dt);var kt=(u+(i=i+Math.imul(D,mt)|0)|0)+((8191&(n=(n=n+Math.imul(D,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863;var Ot=(u+(i=Math.imul(U,mt))|0)+((8191&(n=(n=Math.imul(U,pt))+Math.imul(B,mt)|0))<<13)|0;return u=((o=Math.imul(B,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a[0]=gt,a[1]=vt,a[2]=yt,a[3]=Mt,a[4]=wt,a[5]=bt,a[6]=St,a[7]=At,a[8]=Et,a[9]=_t,a[10]=Nt,a[11]=Rt,a[12]=It,a[13]=Pt,a[14]=xt,a[15]=Ct,a[16]=Tt,a[17]=kt,a[18]=Ot,0!==u&&(a[19]=u,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var h=67108863&i,a=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=a;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),d=67108863&f;h=67108863&(d=d+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}r.words[o]=h,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return v(t,e,r)}function M(t,e){this.x=t,this.y=e}Math.imul||(g=p),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?p(this,t,e):r<1024?v(this,t,e):y(this,t,e)},M.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},M.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},M.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},M.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,a=Math.cos(2*Math.PI/h),u=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=a,d=u,c=0;c<s;c++){var m=r[l+c],p=i[l+c],g=r[l+c+s],v=i[l+c+s],y=f*g-d*v;v=f*v+d*g,g=y,r[l+c]=m+g,i[l+c]=p+v,r[l+c+s]=m-g,i[l+c+s]=p-v,c!==h&&(y=a*f-u*d,d=a*d+u*f,f=y)}},M.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},M.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},M.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},M.prototype.convert13b=function(t,e,r,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)r[s]=0;i(0===o),i(0===(-8192&o))},M.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},M.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),h=new Array(i),a=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),d=r.words;d.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,h,a,i,n),this.transform(u,o,l,f,i,n);for(var c=0;c<i;c++){var m=h[c]*l[c]-a[c]*f[c];a[c]=h[c]*f[c]+a[c]*l[c],h[c]=m}return this.conjugate(h,a,i),this.transform(h,a,d,o,i,n),this.conjugate(d,o,i),this.normalize13b(d,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),i("number"===typeof t),i(t<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(t){i("number"===typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var h=this.words[e]&o,a=(0|this.words[e])-h<<r;this.words[e]=a|s,s=h>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},o.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var n;i("number"===typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,a=r;if(n-=s,n=Math.max(0,n),a){for(var u=0;u<s;u++)a.words[u]=this.words[u];a.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&h}return a&&0!==l&&(a.words[a.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(t){i("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return i("number"===typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"===typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var n,o,s=t.length+r;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+r])+h;var a=(0|t.words[n])*e;h=((o-=67108863&a)>>26)-(a/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)h=(o=(0|this.words[n+r])+h)>>26,this.words[n+r]=67108863&o;if(0===h)return this._strip();for(i(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var h,a=i.length-n.length;if("mod"!==e){(h=new o(null)).length=a+1,h.words=new Array(h.length);for(var u=0;u<h.length;u++)h.words[u]=0}var l=i.clone()._ishlnsubmul(n,1,a);0===l.negative&&(i=l,h&&(h.words[a]=1));for(var f=a-1;f>=0;f--){var d=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(d=Math.min(d/s|0,67108863),i._ishlnsubmul(n,d,f);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);h&&(h.words[f]=d)}return h&&h._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:h||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,e),"mod"!==e&&(n=h.div.neg()),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),e),"mod"!==e&&(n=h.div.neg()),{div:n,mod:h.mod}):0!==(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),e),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),h=new o(0),a=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var d=0,c=1;0===(e.words[0]&c)&&d<26;++d,c<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var m=0,p=1;0===(r.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(h.isOdd()||a.isOdd())&&(h.iadd(l),a.isub(f)),h.iushrn(1),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(h),s.isub(a)):(r.isub(e),h.isub(n),a.isub(s))}return{a:h,b:a,gcd:r.iushln(u)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),h=new o(0),a=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0===(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);for(var f=0,d=1;0===(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(a),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(h)):(r.isub(e),h.isub(s))}return(n=0===e.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"===typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,s=r;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new N(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function R(t){N.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(S,b),S.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(A,b),n(E,b),n(_,b),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new A;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},N.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},N.prototype._verify2=function(t,e){i(0===(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},N.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(l(t,t.umod(this.m)._forceRed(this)),t)},N.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},N.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},N.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},N.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},N.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},N.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},N.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},N.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},N.prototype.isqr=function(t){return this.imul(t,t.clone())},N.prototype.sqr=function(t){return this.mul(t,t)},N.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var h=new o(1).toRed(this),a=h.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(a);)l.redIAdd(a);for(var f=this.pow(l,n),d=this.pow(t,n.addn(1).iushrn(1)),c=this.pow(t,n),m=s;0!==c.cmp(h);){for(var p=c,g=0;0!==p.cmp(h);g++)p=p.redSqr();i(g<m);var v=this.pow(f,new o(1).iushln(m-g-1));d=d.redMul(v),f=v.redSqr(),c=c.redMul(f),m=g}return d},N.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},N.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],s=0,h=0,a=e.bitLength()%26;for(0===a&&(a=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=a-1;l>=0;l--){var f=u>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===i&&0===l)&&(n=this.mul(n,r[s]),h=0,s=0)):h=0}a=26}return n},N.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},N.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new R(t)},n(R,N),R.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},R.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},R.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},R.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},R.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(88)(t))}}]);