@snapshot-labs/snapshot.js 0.12.26 → 0.12.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/snapshot.min.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
|
-
***************************************************************************** */function t(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function e(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})})),e}function o(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=o((function(t,e){var i="undefined"!=typeof self?self:r,n=function(){function t(){this.fetch=!1,this.DOMException=i.DOMException}return t.prototype=i,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function m(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function p(t){var e=new FileReader,r=m(e);return e.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,r,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=m(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=u(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},f.prototype.delete=function(t){delete this.map[u(t)]},f.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},f.prototype.set=function(t,e){this.map[u(t)]=l(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,i,n=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),v.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function M(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},M.error=function(){var t=new M(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];M.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new M(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(i,o){var s=new w(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;i(new M(n,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&n&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",h)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=f,t.Request=w,t.Response=M),e.Headers=f,e.Request=w,e.Response=M,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e})),a=i(s);let h=!1,u=!1;const l={debug:1,default:2,info:2,warning:3,error:4,off:5};let c=l.default,f=null;const d=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 m,p;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(m||(m={})),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"}(p||(p={}));const g="0123456789abcdef";class y{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",t),c>l[r]||console.log.apply(console,e)}debug(...t){this._log(y.levels.DEBUG,t)}info(...t){this._log(y.levels.INFO,t)}warn(...t){this._log(y.levels.WARNING,t)}makeError(t,e,r){if(u)return this.makeError("censored error",e,{});e||(e=y.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+=g[e[t]>>4],r+=g[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case p.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case p.CALL_EXCEPTION:case p.INSUFFICIENT_FUNDS:case p.MISSING_NEW:case p.NONCE_EXPIRED:case p.REPLACEMENT_UNDERPRICED:case p.TRANSACTION_REPLACED:case p.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,y.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){d&&this.throwError("platform missing String.prototype.normalize",y.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,y.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,y.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",y.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",y.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",y.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return f||(f=new y("logger/5.6.0")),f}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),h){if(!t)return;this.globalLogger().throwError("error censorship permanent",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}u=!!t,h=!!e}static setLogLevel(t){const e=l[t.toLowerCase()];null!=e?c=e:y.globalLogger().warn("invalid log level - "+t)}static from(t){return new y(t)}}y.errors=p,y.levels=m;const v=new y("bytes/5.6.1");function w(t){return!!t.toHexString}function b(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return b(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function M(t){return N(t)&&!(t.length%2)||E(t)}function _(t){return"number"==typeof t&&t==t&&t%1==0}function E(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!_(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!_(r)||r<0||r>=256)return!1}return!0}function A(t,e){if(e||(e={}),"number"==typeof t){v.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),b(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),w(t)&&(t=t.toHexString()),N(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":v.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 b(new Uint8Array(i))}return E(t)?b(new Uint8Array(t)):v.throwArgumentError("invalid arrayify value","value",t)}function k(t){const e=t.map((t=>A(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),b(i)}function x(t){let e=A(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function N(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const S="0123456789abcdef";function I(t,e){if(e||(e={}),"number"==typeof t){v.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=S[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),w(t))return t.toHexString();if(N(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":v.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(E(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=S[(240&i)>>4]+S[15&i]}return e}return v.throwArgumentError("invalid hexlify value","value",t)}function R(t){if("string"!=typeof t)t=I(t);else if(!N(t)||t.length%2)return null;return(t.length-2)/2}function T(t,e,r){return"string"!=typeof t?t=I(t):(!N(t)||t.length%2)&&v.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function C(t){let e="0x";return t.forEach((t=>{e+=I(t).substring(2)})),e}function P(t){const e=function(t){"string"!=typeof t&&(t=I(t));N(t)||v.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(I(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function O(t,e){for("string"!=typeof t?t=I(t):N(t)||v.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&v.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function B(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(M(t)){let r=A(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64))):65===r.length?(e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64)),e.v=r[64]):v.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:v.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=I(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=A(t)).length>e&&v.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),b(r)}(A(e._vs),32);e._vs=I(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&v.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=I(r);null==e.s?e.s=n:e.s!==n&&v.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?v.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&&v.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&N(e.r)?e.r=O(e.r,32):v.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&N(e.s)?e.s=O(e.s,32):v.throwArgumentError("signature missing or invalid s","signature",t);const r=A(e.s);r[0]>=128&&v.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=I(r);e._vs&&(N(e._vs)||v.throwArgumentError("signature invalid _vs","signature",t),e._vs=O(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&v.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var $="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},U=[],D=[],L="undefined"!=typeof Uint8Array?Uint8Array:Array,F=!1;function j(){F=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)U[e]=t[e],D[t.charCodeAt(e)]=e;D["-".charCodeAt(0)]=62,D["_".charCodeAt(0)]=63}function z(t,e,r){for(var i,n,o=[],s=e;s<r;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(U[(n=i)>>18&63]+U[n>>12&63]+U[n>>6&63]+U[63&n]);return o.join("")}function q(t){var e;F||j();for(var r=t.length,i=r%3,n="",o=[],s=16383,a=0,h=r-i;a<h;a+=s)o.push(z(t,a,a+s>h?h:a+s));return 1===i?(e=t[r-1],n+=U[e>>2],n+=U[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=U[e>>10],n+=U[e>>4&63],n+=U[e<<2&63],n+="="),o.push(n),o.join("")}function H(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<<a)-1,u=h>>1,l=-7,c=r?n-1:0,f=r?-1:1,d=t[e+c];for(c+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+c],c+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+t[e+c],c+=f,l-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)}function V(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,l=(1<<u)-1,c=l>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,m=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(s++,h/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*h-1)*Math.pow(2,n),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;t[r+d]=255&a,d+=m,a/=256,n-=8);for(s=s<<n|a,u+=n;u>0;t[r+d]=255&s,d+=m,s/=256,u-=8);t[r+d-m]|=128*p}var Z={}.toString,G=Array.isArray||function(t){return"[object Array]"==Z.call(t)};W.TYPED_ARRAY_SUPPORT=void 0===$.TYPED_ARRAY_SUPPORT||$.TYPED_ARRAY_SUPPORT;var K=J();function J(){return W.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Q(t,e){if(J()<e)throw new RangeError("Invalid typed array length");return W.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=W.prototype:(null===t&&(t=new W(e)),t.length=e),t}function W(t,e,r){if(!(W.TYPED_ARRAY_SUPPORT||this instanceof W))return new W(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return tt(this,t)}return Y(this,t,e,r)}function Y(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);W.TYPED_ARRAY_SUPPORT?(t=e).__proto__=W.prototype:t=et(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!W.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|nt(e,r),n=(t=Q(t,i)).write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(it(e)){var r=0|rt(e.length);return 0===(t=Q(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?Q(t,0):et(t,e);if("Buffer"===e.type&&G(e.data))return et(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function X(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function tt(t,e){if(X(e),t=Q(t,e<0?0:0|rt(e)),!W.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function et(t,e){var r=e.length<0?0:0|rt(e.length);t=Q(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function rt(t){if(t>=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return 0|t}function it(t){return!(null==t||!t._isBuffer)}function nt(t,e){if(it(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Tt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ct(t).length;default:if(i)return Tt(t).length;e=(""+e).toLowerCase(),i=!0}}function ot(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return bt(this,e,r);case"utf8":case"utf-8":return gt(this,e,r);case"ascii":return vt(this,e,r);case"latin1":case"binary":return wt(this,e,r);case"base64":return pt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function st(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function at(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=W.from(e,i)),it(e))return 0===e.length?-1:ht(t,e,r,i,n);if("number"==typeof e)return e&=255,W.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ht(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function ht(t,e,r,i,n){var o,s=1,a=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var l=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===h)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var c=!0,f=0;f<h;f++)if(u(t,o+f)!==u(e,f)){c=!1;break}if(c)return o}return-1}function ut(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function lt(t,e,r,i){return Pt(Tt(e,t.length-r),t,r,i)}function ct(t,e,r,i){return Pt(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function ft(t,e,r,i){return ct(t,e,r,i)}function dt(t,e,r,i){return Pt(Ct(e),t,r,i)}function mt(t,e,r,i){return Pt(function(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function pt(t,e,r){return 0===e&&r===t.length?q(t):q(t.slice(e,r))}function gt(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,h,u=t[n],l=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(l=h);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(t){var e=t.length;if(e<=yt)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=yt));return r}(i)}W.poolSize=8192,W._augment=function(t){return t.__proto__=W.prototype,t},W.from=function(t,e,r){return Y(null,t,e,r)},W.TYPED_ARRAY_SUPPORT&&(W.prototype.__proto__=Uint8Array.prototype,W.__proto__=Uint8Array),W.alloc=function(t,e,r){return function(t,e,r,i){return X(e),e<=0?Q(t,e):void 0!==r?"string"==typeof i?Q(t,e).fill(r,i):Q(t,e).fill(r):Q(t,e)}(null,t,e,r)},W.allocUnsafe=function(t){return tt(null,t)},W.allocUnsafeSlow=function(t){return tt(null,t)},W.isBuffer=Ot,W.compare=function(t,e){if(!it(t)||!it(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},W.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},W.concat=function(t,e){if(!G(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return W.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=W.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!it(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},W.byteLength=nt,W.prototype._isBuffer=!0,W.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)st(this,e,e+1);return this},W.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)st(this,e,e+3),st(this,e+1,e+2);return this},W.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)st(this,e,e+7),st(this,e+1,e+6),st(this,e+2,e+5),st(this,e+3,e+4);return this},W.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?gt(this,0,t):ot.apply(this,arguments)},W.prototype.equals=function(t){if(!it(t))throw new TypeError("Argument must be a Buffer");return this===t||0===W.compare(this,t)},W.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},W.prototype.compare=function(t,e,r,i,n){if(!it(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(i,n),u=t.slice(e,r),l=0;l<a;++l)if(h[l]!==u[l]){o=h[l],s=u[l];break}return o<s?-1:s<o?1:0},W.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},W.prototype.indexOf=function(t,e,r){return at(this,t,e,r,!0)},W.prototype.lastIndexOf=function(t,e,r){return at(this,t,e,r,!1)},W.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return ut(this,t,e,r);case"utf8":case"utf-8":return lt(this,t,e,r);case"ascii":return ct(this,t,e,r);case"latin1":case"binary":return ft(this,t,e,r);case"base64":return dt(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},W.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var yt=4096;function vt(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function wt(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function bt(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=Rt(t[o]);return n}function Mt(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function _t(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function Et(t,e,r,i,n,o){if(!it(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function At(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n<o;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function kt(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n<o;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function xt(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Nt(t,e,r,i,n){return n||xt(t,0,r,4),V(t,e,r,i,23,4),r+4}function St(t,e,r,i,n){return n||xt(t,0,r,8),V(t,e,r,i,52,8),r+8}W.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),W.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=W.prototype;else{var n=e-t;r=new W(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+t]}return r},W.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},W.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},W.prototype.readUInt8=function(t,e){return e||_t(t,1,this.length),this[t]},W.prototype.readUInt16LE=function(t,e){return e||_t(t,2,this.length),this[t]|this[t+1]<<8},W.prototype.readUInt16BE=function(t,e){return e||_t(t,2,this.length),this[t]<<8|this[t+1]},W.prototype.readUInt32LE=function(t,e){return e||_t(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},W.prototype.readUInt32BE=function(t,e){return e||_t(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},W.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},W.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},W.prototype.readInt8=function(t,e){return e||_t(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},W.prototype.readInt16LE=function(t,e){e||_t(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},W.prototype.readInt16BE=function(t,e){e||_t(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},W.prototype.readInt32LE=function(t,e){return e||_t(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},W.prototype.readInt32BE=function(t,e){return e||_t(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},W.prototype.readFloatLE=function(t,e){return e||_t(t,4,this.length),H(this,t,!0,23,4)},W.prototype.readFloatBE=function(t,e){return e||_t(t,4,this.length),H(this,t,!1,23,4)},W.prototype.readDoubleLE=function(t,e){return e||_t(t,8,this.length),H(this,t,!0,52,8)},W.prototype.readDoubleBE=function(t,e){return e||_t(t,8,this.length),H(this,t,!1,52,8)},W.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Et(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},W.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Et(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},W.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,1,255,0),W.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},W.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,65535,0),W.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):At(this,t,e,!0),e+2},W.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,65535,0),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):At(this,t,e,!1),e+2},W.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,4294967295,0),W.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):kt(this,t,e,!0),e+4},W.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,4294967295,0),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):kt(this,t,e,!1),e+4},W.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Et(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},W.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Et(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},W.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,1,127,-128),W.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},W.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,32767,-32768),W.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):At(this,t,e,!0),e+2},W.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,32767,-32768),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):At(this,t,e,!1),e+2},W.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,2147483647,-2147483648),W.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):kt(this,t,e,!0),e+4},W.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):kt(this,t,e,!1),e+4},W.prototype.writeFloatLE=function(t,e,r){return Nt(this,t,e,!0,r)},W.prototype.writeFloatBE=function(t,e,r){return Nt(this,t,e,!1,r)},W.prototype.writeDoubleLE=function(t,e,r){return St(this,t,e,!0,r)},W.prototype.writeDoubleBE=function(t,e,r){return St(this,t,e,!1,r)},W.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n,o=i-r;if(this===t&&r<e&&e<i)for(n=o-1;n>=0;--n)t[n+e]=this[n+r];else if(o<1e3||!W.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},W.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!W.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=it(t)?t:Tt(new W(t,i).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var It=/[^+\/0-9A-Za-z-_]/g;function Rt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Tt(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Ct(t){return function(t){var e,r,i,n,o,s;F||j();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new L(3*a/4-o),i=o>0?a-4:a;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)n=D[t.charCodeAt(e)]<<18|D[t.charCodeAt(e+1)]<<12|D[t.charCodeAt(e+2)]<<6|D[t.charCodeAt(e+3)],s[h++]=n>>16&255,s[h++]=n>>8&255,s[h++]=255&n;return 2===o?(n=D[t.charCodeAt(e)]<<2|D[t.charCodeAt(e+1)]>>4,s[h++]=255&n):1===o&&(n=D[t.charCodeAt(e)]<<10|D[t.charCodeAt(e+1)]<<4|D[t.charCodeAt(e+2)]>>2,s[h++]=n>>8&255,s[h++]=255&n),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(It,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Pt(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Ot(t){return null!=t&&(!!t._isBuffer||Bt(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Bt(t.slice(0,0))}(t))}function Bt(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var $t=n(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:K,Buffer:W,SlowBuffer:function(t){return+t!=t&&(t=0),W.alloc(+t)},isBuffer:Ot})),Ut=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Dt=Ut.BN;const Lt=new y("bignumber/5.6.2"),Ft={},jt=9007199254740991;let zt=!1;class qt{constructor(t,e){t!==Ft&&Lt.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Vt(Zt(this).fromTwos(t))}toTwos(t){return Vt(Zt(this).toTwos(t))}abs(){return"-"===this._hex[0]?qt.from(this._hex.substring(1)):this}add(t){return Vt(Zt(this).add(Zt(t)))}sub(t){return Vt(Zt(this).sub(Zt(t)))}div(t){return qt.from(t).isZero()&&Gt("division-by-zero","div"),Vt(Zt(this).div(Zt(t)))}mul(t){return Vt(Zt(this).mul(Zt(t)))}mod(t){const e=Zt(t);return e.isNeg()&&Gt("division-by-zero","mod"),Vt(Zt(this).umod(e))}pow(t){const e=Zt(t);return e.isNeg()&&Gt("negative-power","pow"),Vt(Zt(this).pow(e))}and(t){const e=Zt(t);return(this.isNegative()||e.isNeg())&&Gt("unbound-bitwise-result","and"),Vt(Zt(this).and(e))}or(t){const e=Zt(t);return(this.isNegative()||e.isNeg())&&Gt("unbound-bitwise-result","or"),Vt(Zt(this).or(e))}xor(t){const e=Zt(t);return(this.isNegative()||e.isNeg())&&Gt("unbound-bitwise-result","xor"),Vt(Zt(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Gt("negative-width","mask"),Vt(Zt(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Gt("negative-width","shl"),Vt(Zt(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Gt("negative-width","shr"),Vt(Zt(this).shrn(t))}eq(t){return Zt(this).eq(Zt(t))}lt(t){return Zt(this).lt(Zt(t))}lte(t){return Zt(this).lte(Zt(t))}gt(t){return Zt(this).gt(Zt(t))}gte(t){return Zt(this).gte(Zt(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Zt(this).isZero()}toNumber(){try{return Zt(this).toNumber()}catch(t){Gt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Lt.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zt||(zt=!0,Lt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Lt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Lt.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Zt(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof qt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new qt(Ft,Ht(t)):t.match(/^-?[0-9]+$/)?new qt(Ft,Ht(new Dt(t))):Lt.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Gt("underflow","BigNumber.from",t),(t>=jt||t<=-jt)&&Gt("overflow","BigNumber.from",t),qt.from(String(t));const e=t;if("bigint"==typeof e)return qt.from(e.toString());if(E(e))return qt.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return qt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return qt.from(t)}return Lt.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Ht(t){if("string"!=typeof t)return Ht(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Lt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ht(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 Vt(t){return qt.from(Ht(t))}function Zt(t){const e=qt.from(t).toHexString();return"-"===e[0]?new Dt("-"+e.substring(3),16):new Dt(e.substring(2),16)}function Gt(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Lt.throwError(t,y.errors.NUMERIC_FAULT,i)}function Kt(){throw new Error("setTimeout has not been defined")}function Jt(){throw new Error("clearTimeout has not been defined")}var Qt=Kt,Wt=Jt;function Yt(t){if(Qt===setTimeout)return setTimeout(t,0);if((Qt===Kt||!Qt)&&setTimeout)return Qt=setTimeout,setTimeout(t,0);try{return Qt(t,0)}catch(e){try{return Qt.call(null,t,0)}catch(e){return Qt.call(this,t,0)}}}"function"==typeof $.setTimeout&&(Qt=setTimeout),"function"==typeof $.clearTimeout&&(Wt=clearTimeout);var Xt,te=[],ee=!1,re=-1;function ie(){ee&&Xt&&(ee=!1,Xt.length?te=Xt.concat(te):re=-1,te.length&&ne())}function ne(){if(!ee){var t=Yt(ie);ee=!0;for(var e=te.length;e;){for(Xt=te,te=[];++re<e;)Xt&&Xt[re].run();re=-1,e=te.length}Xt=null,ee=!1,function(t){if(Wt===clearTimeout)return clearTimeout(t);if((Wt===Jt||!Wt)&&clearTimeout)return Wt=clearTimeout,clearTimeout(t);try{Wt(t)}catch(e){try{return Wt.call(null,t)}catch(e){return Wt.call(this,t)}}}(t)}}function oe(t,e){this.fun=t,this.array=e}oe.prototype.run=function(){this.fun.apply(null,this.array)};function se(){}var ae=se,he=se,ue=se,le=se,ce=se,fe=se,de=se;var me=$.performance||{},pe=me.now||me.mozNow||me.msNow||me.oNow||me.webkitNow||function(){return(new Date).getTime()};var ge=new Date;var ye={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];te.push(new oe(t,e)),1!==te.length||ee||Yt(ne)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ae,addListener:he,once:ue,off:le,removeListener:ce,removeAllListeners:fe,emit:de,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*pe.call(me),r=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(r-=t[0],(i-=t[1])<0&&(r--,i+=1e9)),[r,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ge)/1e3}},ve=o((function(t){!function(){var e="input is invalid type",i="object"==typeof window,n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var o=!i&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof ye&&ye.versions&&ye.versions.node?n=r:o&&(n=self);var s=!n.JS_SHA3_NO_COMMON_JS&&t.exports,a=!n.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),u=[4,1024,262144,67108864],l=[0,8,16,24],c=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],f=[224,256,384,512],d=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!n.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var g=function(t,e,r){return function(i){return new T(t,e,t).update(i)[r]()}},y=function(t,e,r){return function(i,n){return new T(t,e,n).update(i)[r]()}},v=function(t,e,r){return function(e,i,n,o){return E["cshake"+t].update(e,i,n,o)[r]()}},w=function(t,e,r){return function(e,i,n,o){return E["kmac"+t].update(e,i,n,o)[r]()}},b=function(t,e,r,i){for(var n=0;n<m.length;++n){var o=m[n];t[o]=e(r,i,o)}return t},M=function(t,e){var r=g(t,e,"hex");return r.create=function(){return new T(t,e,t)},r.update=function(t){return r.create().update(t)},b(r,g,t,e)},_=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:M},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:M},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var r=y(t,e,"hex");return r.create=function(r){return new T(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},b(r,y,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var r=p[t],i=v(t,0,"hex");return i.create=function(i,n,o){return n||o?new T(t,e,i).bytepad([n,o],r):E["shake"+t].create(i)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},b(i,v,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var r=p[t],i=w(t,0,"hex");return i.create=function(i,n,o){return new C(t,e,n).bytepad(["KMAC",o],r).bytepad([i],r)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},b(i,w,t,e)}}],E={},A=[],k=0;k<_.length;++k)for(var x=_[k],N=x.bits,S=0;S<N.length;++S){var I=x.name+"_"+N[S];if(A.push(I),E[I]=x.createMethod(N[S],x.padding),"sha3"!==x.name){var R=x.name+N[S];A.push(R),E[R]=E[I]}}function T(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var i=0;i<50;++i)this.s[i]=0}function C(t,e,r){T.call(this,t,e,r)}T.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var n,o,s=this.blocks,h=this.byteCount,u=t.length,c=this.blockCount,f=0,d=this.s;f<u;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<c+1;++n)s[n]=0;if(r)for(n=this.start;f<u&&n<h;++f)s[n>>2]|=t[f]<<l[3&n++];else for(n=this.start;f<u&&n<h;++f)(o=t.charCodeAt(f))<128?s[n>>2]|=o<<l[3&n++]:o<2048?(s[n>>2]|=(192|o>>6)<<l[3&n++],s[n>>2]|=(128|63&o)<<l[3&n++]):o<55296||o>=57344?(s[n>>2]|=(224|o>>12)<<l[3&n++],s[n>>2]|=(128|o>>6&63)<<l[3&n++],s[n>>2]|=(128|63&o)<<l[3&n++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++f)),s[n>>2]|=(240|o>>18)<<l[3&n++],s[n>>2]|=(128|o>>12&63)<<l[3&n++],s[n>>2]|=(128|o>>6&63)<<l[3&n++],s[n>>2]|=(128|63&o)<<l[3&n++]);if(this.lastByteIndex=n,n>=h){for(this.start=n-h,this.block=s[c],n=0;n<c;++n)d[n]^=s[n];P(d),this.reset=!0}else this.start=n}return this},T.prototype.encode=function(t,e){var r=255&t,i=1,n=[r];for(r=255&(t>>=8);r>0;)n.unshift(r),r=255&(t>>=8),++i;return e?n.push(i):n.unshift(i),this.update(n),n.length},T.prototype.encodeString=function(t){var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var n=0,o=t.length;if(r)n=o;else for(var s=0;s<t.length;++s){var h=t.charCodeAt(s);h<128?n+=1:h<2048?n+=2:h<55296||h>=57344?n+=3:(h=65536+((1023&h)<<10|1023&t.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(t),n},T.prototype.bytepad=function(t,e){for(var r=this.encode(e),i=0;i<t.length;++i)r+=this.encodeString(t[i]);var n=e-r%e,o=[];return o.length=n,this.update(o),this},T.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,i=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)i[e]^=t[e];P(i)}},T.prototype.toString=T.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,o=0,s=0,a="";s<i;){for(o=0;o<e&&s<i;++o,++s)t=r[o],a+=h[t>>4&15]+h[15&t]+h[t>>12&15]+h[t>>8&15]+h[t>>20&15]+h[t>>16&15]+h[t>>28&15]+h[t>>24&15];s%e==0&&(P(r),o=0)}return n&&(t=r[o],a+=h[t>>4&15]+h[15&t],n>1&&(a+=h[t>>12&15]+h[t>>8&15]),n>2&&(a+=h[t>>20&15]+h[t>>16&15])),a},T.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=n?new ArrayBuffer(i+1<<2):new ArrayBuffer(a);for(var h=new Uint32Array(t);s<i;){for(o=0;o<e&&s<i;++o,++s)h[s]=r[o];s%e==0&&P(r)}return n&&(h[o]=r[o],t=t.slice(0,a)),t},T.prototype.buffer=T.prototype.arrayBuffer,T.prototype.digest=T.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,i=this.s,n=this.outputBlocks,o=this.extraBytes,s=0,a=0,h=[];a<n;){for(s=0;s<r&&a<n;++s,++a)t=a<<2,e=i[s],h[t]=255&e,h[t+1]=e>>8&255,h[t+2]=e>>16&255,h[t+3]=e>>24&255;a%r==0&&P(i)}return o&&(t=a<<2,e=i[s],h[t]=255&e,o>1&&(h[t+1]=e>>8&255),o>2&&(h[t+2]=e>>16&255)),h},C.prototype=new T,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var P=function(t){var e,r,i,n,o,s,a,h,u,l,f,d,m,p,g,y,v,w,b,M,_,E,A,k,x,N,S,I,R,T,C,P,O,B,$,U,D,L,F,j,z,q,H,V,Z,G,K,J,Q,W,Y,X,tt,et,rt,it,nt,ot,st,at,ht,ut,lt;for(i=0;i<48;i+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],h=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(m=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=n^(h<<1|u>>>31),r=o^(u<<1|h>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=h^(d<<1|m>>>31),r=u^(m<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=l^(n<<1|o>>>31),r=f^(o<<1|n>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,p=t[0],g=t[1],G=t[11]<<4|t[10]>>>28,K=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,R=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ht=t[30]<<9|t[31]>>>23,q=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,B=t[2]<<1|t[3]>>>31,$=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,T=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ut=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,U=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,W=t[34]<<15|t[35]>>>17,Y=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,k=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,it=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,L=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,X=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,Z=t[9]<<27|t[8]>>>5,N=t[18]<<20|t[19]>>>12,S=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,j=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~y&w,t[1]=g^~v&b,t[10]=k^~N&I,t[11]=x^~S&R,t[20]=B^~U&L,t[21]=$^~D&F,t[30]=V^~G&J,t[31]=Z^~K&Q,t[40]=et^~it&ot,t[41]=rt^~nt&st,t[2]=y^~w&M,t[3]=v^~b&_,t[12]=N^~I&T,t[13]=S^~R&C,t[22]=U^~L&j,t[23]=D^~F&z,t[32]=G^~J&W,t[33]=K^~Q&Y,t[42]=it^~ot&at,t[43]=nt^~st&ht,t[4]=w^~M&E,t[5]=b^~_&A,t[14]=I^~T&P,t[15]=R^~C&O,t[24]=L^~j&q,t[25]=F^~z&H,t[34]=J^~W&X,t[35]=Q^~Y&tt,t[44]=ot^~at&ut,t[45]=st^~ht<,t[6]=M^~E&p,t[7]=_^~A&g,t[16]=T^~P&k,t[17]=C^~O&x,t[26]=j^~q&B,t[27]=z^~H&$,t[36]=W^~X&V,t[37]=Y^~tt&Z,t[46]=at^~ut&et,t[47]=ht^~lt&rt,t[8]=E^~p&y,t[9]=A^~g&v,t[18]=P^~k&N,t[19]=O^~x&S,t[28]=q^~B&U,t[29]=H^~$&D,t[38]=X^~V&G,t[39]=tt^~Z&K,t[48]=ut^~et&it,t[49]=lt^~rt&nt,t[0]^=c[i],t[1]^=c[i+1]};if(s)t.exports=E;else for(k=0;k<A.length;++k)n[A[k]]=E[A[k]]}()}));function we(t){return"0x"+ve.keccak_256(A(t))}const be=new y("rlp/5.6.1");function Me(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function _e(t,e,r){let i=0;for(let n=0;n<r;n++)i=256*i+t[e+n];return i}function Ee(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(Ee(t))})),e.length<=55)return e.unshift(192+e.length),e;const r=Me(e.length);return r.unshift(247+r.length),r.concat(e)}M(t)||be.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(A(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=Me(e.length);return r.unshift(183+r.length),r.concat(e)}function Ae(t){return I(Ee(t))}function ke(t,e,r,i){const n=[];for(;r<e+1+i;){const o=xe(t,r);n.push(o.result),(r+=o.consumed)>e+1+i&&be.throwError("child data too short",y.errors.BUFFER_OVERRUN,{})}return{consumed:1+i,result:n}}function xe(t,e){if(0===t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&be.throwError("data short segment too short",y.errors.BUFFER_OVERRUN,{});const i=_e(t,e+1,r);return e+1+r+i>t.length&&be.throwError("data long segment too short",y.errors.BUFFER_OVERRUN,{}),ke(t,e,e+1+r,r+i)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{}),ke(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});const i=_e(t,e+1,r);e+1+r+i>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r+i,result:I(t.slice(e+1+r,e+1+r+i))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:I(t.slice(e+1,e+1+r))}}return{consumed:1,result:I(t[e])}}function Ne(t){const e=A(t),r=xe(e,0);return r.consumed!==e.length&&be.throwArgumentError("invalid rlp data","data",t),r.result}const Se=new y("address/5.6.1");function Ie(t){N(t,20)||Se.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=A(we(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Re={};for(let t=0;t<10;t++)Re[String(t)]=String(t);for(let t=0;t<26;t++)Re[String.fromCharCode(65+t)]=String(10+t);const Te=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Ce(t){let e=null;if("string"!=typeof t&&Se.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Ie(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Se.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)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Re[t])).join("");for(;e.length>=Te;){let t=e.substring(0,Te);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}(t)&&Se.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Dt(r,36).toString(16);e.length<40;)e="0"+e;e=Ie("0x"+e)}else Se.throwArgumentError("invalid address","address",t);var r;return e}function Pe(t){try{return Ce(t),!0}catch(t){}return!1}function Oe(t){let e=null;try{e=Ce(t.from)}catch(e){Se.throwArgumentError("missing from address","transaction",t)}return Ce(T(we(Ae([e,x(A(qt.from(t.nonce).toHexString()))])),12))}const Be={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},$e={Proposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"app",type:"string"}]},Ue={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"plugins",type:"string"}]},De={FlagProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},Le={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},Fe={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},je={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},ze={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},qe={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},He={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},Ve={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},Ze={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},Ge={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Ke={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Je={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Qe={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},We={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},Ye={Statement:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"space",type:"string"},{name:"about",type:"string"},{name:"statement",type:"string"},{name:"discourse",type:"string"},{name:"status",type:"string"},{name:"network",type:"string"}]},Xe={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},tr={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var er={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},rr={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},ir={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const nr={name:"snapshot",version:"0.1.4"};class or{constructor(t=er.sequencer,e={}){t=(t=(t=t.replace(er.hub,er.sequencer)).replace(rr.hub,rr.sequencer)).replace(ir.hub,ir.sequencer),this.address=t,this.options=e}sign(t,r,i,n){return e(this,void 0,void 0,(function*(){var e;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,s=Ce(r);i.from=i.from?Ce(i.from):s,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const a=Object.assign({},nr);"undefined"!=typeof window&&(null===(e=window.ethereum)||void 0===e?void 0:e.isTrust)&&(a.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:a,types:n,message:i},u=yield o._signTypedData(a,h.types,i);return yield this.send({address:s,sig:u,data:h})}))}send(t){return e(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,i)=>{a(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(i).catch(i);throw e})).catch(i)}))}))}space(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Be)}))}proposal(t,r,i){return e(this,void 0,void 0,(function*(){return i.discussion||(i.discussion=""),i.app||(i.app=""),yield this.sign(t,r,i,$e)}))}updateProposal(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ue)}))}flagProposal(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,De)}))}cancelProposal(t,r,i){return e(this,void 0,void 0,(function*(){const e=i.proposal.startsWith("0x");return yield this.sign(t,r,i,e?Fe:Le)}))}vote(t,r,i){return e(this,void 0,void 0,(function*(){const e="shutter"===(null==i?void 0:i.privacy);i.reason||(i.reason=""),i.app||(i.app=""),i.metadata||(i.metadata="{}");const n=i.proposal.startsWith("0x");let o=n?He:je;return["approval","ranked-choice"].includes(i.type)&&(o=n?Ve:ze),!e&&["quadratic","weighted"].includes(i.type)&&(o=n?Ze:qe,i.choice=JSON.stringify(i.choice)),e&&(o=n?Ze:qe),delete i.privacy,delete i.type,yield this.sign(t,r,i,o)}))}follow(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ge)}))}unfollow(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ke)}))}subscribe(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Je)}))}unsubscribe(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Qe)}))}profile(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,We)}))}statement(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ye)}))}alias(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Xe)}))}deleteSpace(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,tr)}))}}var sr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:4e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxLengthWithSpaceType:{default:500,turbo:1e3}},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},ar={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:2e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxLengthWithSpaceType:{default:500,turbo:1e3}},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},hr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:1e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},ur={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},lr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},cr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},fr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}},dr={space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1,maxLength:32},symbol:{type:"string",title:"symbol",minLength:1,maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64,format:"domain"},strategies:{type:"array",minItems:1,maxItemsWithSpaceType:{default:8,turbo:10},uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",maxLength:12,title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",format:"evmAddress"},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",format:"evmAddress"},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",format:"evmAddress"},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"}]},delegationContract:{type:"string",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],anyOf:[{format:"evmAddress"},{format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},delegationNetwork:{type:"string",title:"Delegation network",description:"The network of your delegation contract",anyOf:[{snapshotNetwork:!0},{starknetNetwork:!0}],errorMessage:"Must be a valid network"},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:15552e3,errorMessage:{maximum:"Delay must be less than 180 days"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector"]}},treasuries:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],anyOf:[{format:"evmAddress"},{format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},network:{type:"string",title:"Network",anyOf:[{snapshotNetwork:!0},{starknetNetwork:!0}],errorMessage:"Must be a valid network"}},required:["name","address","network"],additionalProperties:!1}},labels:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{id:{type:"string",title:"Id",minLength:1,maxLength:8},name:{type:"string",title:"Name",minLength:1,maxLength:32},description:{type:"string",title:"Description",maxLength:100},color:{type:"string",title:"Color",format:"color"}},required:["id","name","color"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1}},required:["name","network","symbol","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:sr.definitions.Proposal,updateProposal:ar.definitions.UpdateProposal,vote:hr.definitions.Vote,profile:ur.definitions.Profile,statement:lr.definitions.Statement,zodiac:cr.definitions.Zodiac,alias:fr.definitions.Alias},mr=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var pr=mr.BN;const gr=new y("bignumber/5.6.2"),yr={},vr=9007199254740991;let wr=!1;class br{constructor(t,e){t!==yr&&gr.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return _r(Er(this).fromTwos(t))}toTwos(t){return _r(Er(this).toTwos(t))}abs(){return"-"===this._hex[0]?br.from(this._hex.substring(1)):this}add(t){return _r(Er(this).add(Er(t)))}sub(t){return _r(Er(this).sub(Er(t)))}div(t){return br.from(t).isZero()&&Ar("division-by-zero","div"),_r(Er(this).div(Er(t)))}mul(t){return _r(Er(this).mul(Er(t)))}mod(t){const e=Er(t);return e.isNeg()&&Ar("division-by-zero","mod"),_r(Er(this).umod(e))}pow(t){const e=Er(t);return e.isNeg()&&Ar("negative-power","pow"),_r(Er(this).pow(e))}and(t){const e=Er(t);return(this.isNegative()||e.isNeg())&&Ar("unbound-bitwise-result","and"),_r(Er(this).and(e))}or(t){const e=Er(t);return(this.isNegative()||e.isNeg())&&Ar("unbound-bitwise-result","or"),_r(Er(this).or(e))}xor(t){const e=Er(t);return(this.isNegative()||e.isNeg())&&Ar("unbound-bitwise-result","xor"),_r(Er(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ar("negative-width","mask"),_r(Er(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ar("negative-width","shl"),_r(Er(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ar("negative-width","shr"),_r(Er(this).shrn(t))}eq(t){return Er(this).eq(Er(t))}lt(t){return Er(this).lt(Er(t))}lte(t){return Er(this).lte(Er(t))}gt(t){return Er(this).gt(Er(t))}gte(t){return Er(this).gte(Er(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Er(this).isZero()}toNumber(){try{return Er(this).toNumber()}catch(t){Ar("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return gr.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?wr||(wr=!0,gr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?gr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):gr.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Er(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof br)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new br(yr,Mr(t)):t.match(/^-?[0-9]+$/)?new br(yr,Mr(new pr(t))):gr.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ar("underflow","BigNumber.from",t),(t>=vr||t<=-vr)&&Ar("overflow","BigNumber.from",t),br.from(String(t));const e=t;if("bigint"==typeof e)return br.from(e.toString());if(E(e))return br.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return br.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return br.from(t)}return gr.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Mr(t){if("string"!=typeof t)return Mr(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&gr.throwArgumentError("invalid hex","value",t),"0x00"===(t=Mr(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 _r(t){return br.from(Mr(t))}function Er(t){const e=br.from(t).toHexString();return"-"===e[0]?new pr("-"+e.substring(3),16):new pr(e.substring(2),16)}function Ar(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),gr.throwError(t,y.errors.NUMERIC_FAULT,i)}var kr=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const xr=new y("properties/5.6.0");function Nr(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Sr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Ir(t){return kr(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function Rr(t){const e={};for(const r in t)e[r]=t[r];return e}const Tr={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Cr(t){if(null==t||Tr[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch(t){continue}if(!Cr(i))return!1}return!0}return xr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Pr(t){if(Cr(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Or(t))));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&Nr(e,r,Or(i))}return e}return xr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Or(t){return Pr(t)}class Br{constructor(t){for(const e in t)this[e]=Or(t[e])}}const $r="abi/5.6.4",Ur=new y($r),Dr={};let Lr={calldata:!0,memory:!0,storage:!0},Fr={calldata:!0,memory:!0};function jr(t,e){if("bytes"===t||"string"===t){if(Lr[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Fr[e])return!0;return(Lr[e]||"payable"===e)&&Ur.throwArgumentError("invalid modifier","name",e),!1}function zr(t,e){for(let r in e)Nr(t,r,e[r])}const qr=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Hr=new RegExp(/^(.*)\[([0-9]*)\]$/);class Vr{constructor(t,e){t!==Dr&&Ur.throwError("use fromString",y.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),zr(this,e);let r=this.type.match(Hr);zr(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Vr.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==qr.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===qr.full?", ":",")+")"):e+=this.type,t!==qr.sighash&&(!0===this.indexed&&(e+=" indexed"),t===qr.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Vr.fromString(t,e):Vr.fromObject(t)}static fromObject(t){return Vr.isParamType(t)?t:new Vr(Dr,{name:t.name||null,type:ri(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Vr.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function i(e){Ur.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function n(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||i(r),s.state.allowType=!1,s.type=ri(s.type),s.components=[n(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(e||i(r),s.indexed=!0,s.name=""),jr(s.type,s.name)&&(s.name=""),s.type=ri(s.type);let t=s;s=s.parent,s||i(r),delete t.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(e||i(r),s.indexed=!0,s.name=""),jr(s.type,s.name)&&(s.name=""),s.type=ri(s.type);let a=n(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=ri(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(e||i(r),s.indexed&&i(r),s.indexed=!0,s.name=""):jr(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||i(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||i(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:i(r)}}return s.parent&&Ur.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===s.name?(e||i(r.length-7),s.indexed&&i(r.length-7),s.indexed=!0,s.name=""):jr(s.type,s.name)&&(s.name=""),o.type=ri(o.type),o}(t,!!e),Vr.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function Zr(t,e){return function(t){t=t.trim();let e=[],r="",i=0;for(let n=0;n<t.length;n++){let o=t[n];","===o&&0===i?(e.push(r),r=""):(r+=o,"("===o?i++:")"===o&&(i--,-1===i&&Ur.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Vr.fromString(t,e)))}class Gr{constructor(t,e){t!==Dr&&Ur.throwError("use a static from method",y.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),zr(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Gr.isFragment(t)?t:"string"==typeof t?Gr.fromString(t):Gr.fromObject(t)}static fromObject(t){if(Gr.isFragment(t))return t;switch(t.type){case"function":return Xr.fromObject(t);case"event":return Kr.fromObject(t);case"constructor":return Yr.fromObject(t);case"error":return ei.fromObject(t);case"fallback":case"receive":return null}return Ur.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Kr.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Xr.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Yr.fromString(t.trim()):"error"===t.split(" ")[0]?ei.fromString(t.substring(5).trim()):Ur.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Kr extends Gr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qr.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ",t!==qr.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Kr.fromString(t):Kr.fromObject(t)}static fromObject(t){if(Kr.isEventFragment(t))return t;"event"!==t.type&&Ur.throwArgumentError("invalid event object","value",t);const e={name:ni(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Vr.fromObject):[],type:"event"};return new Kr(Dr,e)}static fromString(t){let e=t.match(oi);e||Ur.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:Ur.warn("unknown modifier: "+t)}})),Kr.fromObject({name:e[1].trim(),anonymous:r,inputs:Zr(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Jr(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&Ur.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ur.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=br.from(r[1]),r[0]):t}function Qr(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Wr(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Ur.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Ur.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Ur.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ur.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Ur.throwArgumentError("unable to determine stateMutability","value",t),e}class Yr extends Gr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===qr.sighash&&Ur.throwError("cannot format a constructor for sighash",y.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Yr.fromString(t):Yr.fromObject(t)}static fromObject(t){if(Yr.isConstructorFragment(t))return t;"constructor"!==t.type&&Ur.throwArgumentError("invalid constructor object","value",t);let e=Wr(t);e.constant&&Ur.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Vr.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?br.from(t.gas):null};return new Yr(Dr,r)}static fromString(t){let e={type:"constructor"},r=(t=Jr(t,e)).match(oi);return r&&"constructor"===r[1].trim()||Ur.throwArgumentError("invalid constructor string","value",t),e.inputs=Zr(r[2].trim(),!1),Qr(r[3].trim(),e),Yr.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Xr extends Yr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qr.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ",t!==qr.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Xr.fromString(t):Xr.fromObject(t)}static fromObject(t){if(Xr.isFunctionFragment(t))return t;"function"!==t.type&&Ur.throwArgumentError("invalid function object","value",t);let e=Wr(t);const r={type:t.type,name:ni(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Vr.fromObject):[],outputs:t.outputs?t.outputs.map(Vr.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?br.from(t.gas):null};return new Xr(Dr,r)}static fromString(t){let e={type:"function"},r=(t=Jr(t,e)).split(" returns ");r.length>2&&Ur.throwArgumentError("invalid function string","value",t);let i=r[0].match(oi);if(i||Ur.throwArgumentError("invalid function signature","value",t),e.name=i[1].trim(),e.name&&ni(e.name),e.inputs=Zr(i[2],!1),Qr(i[3].trim(),e),r.length>1){let i=r[1].match(oi);""==i[1].trim()&&""==i[3].trim()||Ur.throwArgumentError("unexpected tokens","value",t),e.outputs=Zr(i[2],!1)}else e.outputs=[];return Xr.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function ti(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Ur.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Gr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qr.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?ei.fromString(t):ei.fromObject(t)}static fromObject(t){if(ei.isErrorFragment(t))return t;"error"!==t.type&&Ur.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:ni(t.name),inputs:t.inputs?t.inputs.map(Vr.fromObject):[]};return ti(new ei(Dr,e))}static fromString(t){let e={type:"error"},r=t.match(oi);return r||Ur.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&ni(e.name),e.inputs=Zr(r[2],!1),ti(ei.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function ri(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const ii=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ni(t){return t&&t.match(ii)||Ur.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const oi=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const si=new y($r);class ai{constructor(t,e,r,i){this.name=t,this.type=e,this.localName=r,this.dynamic=i}_throwError(t,e){si.throwArgumentError(t,this.localName,e)}}class hi{constructor(t){Nr(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return C(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(k(t._data))}writeBytes(t){let e=A(t);const r=e.length%this.wordSize;return r&&(e=k([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=A(br.from(t));return e.length>this.wordSize&&si.throwError("value out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=k([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class ui{constructor(t,e,r,i){Nr(this,"_data",A(t)),Nr(this,"wordSize",e||32),Nr(this,"_coerceFunc",r),Nr(this,"allowLoose",i),this._offset=0}get data(){return I(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):ui.coerce(t,e)}_peekBytes(t,e,r){let i=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?i=e:si.throwError("data out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(t){return new ui(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return br.from(this.readBytes(this.wordSize))}}class li extends ai{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Ce(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Ce(O(t.readValue().toHexString(),20))}}class ci extends ai{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const fi=new y($r);function di(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&"object"==typeof r){let t={};i=e.map((e=>{const i=e.localName;return i||fi.throwError("cannot encode object for signature with missing names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[i]&&fi.throwError("cannot encode object for signature with duplicate names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[i]=!0,r[i]}))}else fi.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&fi.throwArgumentError("types/value length mismatch","tuple",r);let n=new hi(t.wordSize),o=new hi(t.wordSize),s=[];e.forEach(((t,e)=>{let r=i[e];if(t.dynamic){let e=o.length;t.encode(o,r);let i=n.writeUpdatableValue();s.push((t=>{i(t+e)}))}else t.encode(n,r)})),s.forEach((t=>{t(n.length)}));let a=t.appendWriter(n);return a+=t.appendWriter(o),a}function mi(t,e){let r=[],i=t.subReader(0);e.forEach((e=>{let n=null;if(e.dynamic){let r=t.readValue(),o=i.subReader(r.toNumber());try{n=e.decode(o)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;n=t,n.baseType=e.name,n.name=e.localName,n.type=e.type}}else try{n=e.decode(t)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;n=t,n.baseType=e.name,n.name=e.localName,n.type=e.type}null!=n&&r.push(n)}));const n=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let i=t.localName;if(!i||1!==n[i])return;if("length"===i&&(i="_length"),null!=r[i])return;const o=r[e];o instanceof Error?Object.defineProperty(r,i,{enumerable:!0,get:()=>{throw o}}):r[i]=o}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class pi extends ai{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),fi.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let i=[];for(let t=0;t<e.length;t++)i.push(this.coder);return di(t,i,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&fi.throwError("insufficient data length",y.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new ci(this.coder));return t.coerce(this.name,mi(t,r))}}class gi extends ai{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class yi extends ai{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=A(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class vi extends yi{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,I(super.decode(t)))}}class wi extends ai{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=A(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,I(t.readBytes(this.size)))}}class bi extends ai{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}var Mi=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var _i=Mi.BN;const Ei=new y("bignumber/5.6.2"),Ai={},ki=9007199254740991;let xi=!1;class Ni{constructor(t,e){t!==Ai&&Ei.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Ii(Ri(this).fromTwos(t))}toTwos(t){return Ii(Ri(this).toTwos(t))}abs(){return"-"===this._hex[0]?Ni.from(this._hex.substring(1)):this}add(t){return Ii(Ri(this).add(Ri(t)))}sub(t){return Ii(Ri(this).sub(Ri(t)))}div(t){return Ni.from(t).isZero()&&Ti("division-by-zero","div"),Ii(Ri(this).div(Ri(t)))}mul(t){return Ii(Ri(this).mul(Ri(t)))}mod(t){const e=Ri(t);return e.isNeg()&&Ti("division-by-zero","mod"),Ii(Ri(this).umod(e))}pow(t){const e=Ri(t);return e.isNeg()&&Ti("negative-power","pow"),Ii(Ri(this).pow(e))}and(t){const e=Ri(t);return(this.isNegative()||e.isNeg())&&Ti("unbound-bitwise-result","and"),Ii(Ri(this).and(e))}or(t){const e=Ri(t);return(this.isNegative()||e.isNeg())&&Ti("unbound-bitwise-result","or"),Ii(Ri(this).or(e))}xor(t){const e=Ri(t);return(this.isNegative()||e.isNeg())&&Ti("unbound-bitwise-result","xor"),Ii(Ri(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ti("negative-width","mask"),Ii(Ri(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ti("negative-width","shl"),Ii(Ri(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ti("negative-width","shr"),Ii(Ri(this).shrn(t))}eq(t){return Ri(this).eq(Ri(t))}lt(t){return Ri(this).lt(Ri(t))}lte(t){return Ri(this).lte(Ri(t))}gt(t){return Ri(this).gt(Ri(t))}gte(t){return Ri(this).gte(Ri(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ri(this).isZero()}toNumber(){try{return Ri(this).toNumber()}catch(t){Ti("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ei.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?xi||(xi=!0,Ei.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ei.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Ei.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Ri(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ni)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ni(Ai,Si(t)):t.match(/^-?[0-9]+$/)?new Ni(Ai,Si(new _i(t))):Ei.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ti("underflow","BigNumber.from",t),(t>=ki||t<=-ki)&&Ti("overflow","BigNumber.from",t),Ni.from(String(t));const e=t;if("bigint"==typeof e)return Ni.from(e.toString());if(E(e))return Ni.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ni.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return Ni.from(t)}return Ei.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Si(t){if("string"!=typeof t)return Si(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ei.throwArgumentError("invalid hex","value",t),"0x00"===(t=Si(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 Ii(t){return Ni.from(Si(t))}function Ri(t){const e=Ni.from(t).toHexString();return"-"===e[0]?new _i("-"+e.substring(3),16):new _i(e.substring(2),16)}function Ti(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Ei.throwError(t,y.errors.NUMERIC_FAULT,i)}const Ci=Ni.from(-1),Pi=Ni.from(0),Oi=Ni.from(1),Bi=Ni.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class $i extends ai{constructor(t,e,r){const i=(e?"int":"uint")+8*t;super(i,i,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=br.from(e),i=Bi.mask(8*t.wordSize);if(this.signed){let t=i.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(Oi).mul(Ci)))&&this._throwError("value out-of-bounds",e)}else(r.lt(Pi)||r.gt(i.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}const Ui=new y("strings/5.6.1");var Di,Li;function Fi(t,e,r,i,n){if(t===Li.BAD_PREFIX||t===Li.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===Li.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Di||(Di={})),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"}(Li||(Li={}));const ji=Object.freeze({error:function(t,e,r,i,n){return Ui.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Fi,replace:function(t,e,r,i,n){return t===Li.OVERLONG?(i.push(n),0):(i.push(65533),Fi(t,e,r))}});function zi(t,e){null==e&&(e=ji.error),t=A(t);const r=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,s=null;if(192==(224&n))o=1,s=127;else if(224==(240&n))o=2,s=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?Li.UNEXPECTED_CONTINUE:Li.BAD_PREFIX,i-1,t,r);continue}o=3,s=65535}if(i-1+o>=t.length){i+=e(Li.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let n=0;n<o;n++){let n=t[i];if(128!=(192&n)){i+=e(Li.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|63&n,i++}null!==a&&(a>1114111?i+=e(Li.OUT_OF_RANGE,i-1-o,t,r,a):a>=55296&&a<=57343?i+=e(Li.UTF16_SURROGATE,i-1-o,t,r,a):a<=s?i+=e(Li.OVERLONG,i-1-o,t,r,a):r.push(a))}return r}function qi(t,e=Di.current){e!=Di.current&&(Ui.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return A(r)}function Hi(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Vi(t,e){return Hi(zi(t,e))}function Zi(t,e=Di.current){return zi(qi(t,e))}function Gi(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,i={};return t.split(",").forEach((t=>{let n=t.split(":");r+=parseInt(n[0],16),i[r]=e(n[1])})),i}function Ki(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let i=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:i,h:e}}))}function Ji(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];if(r+=n.l,t>=r&&t<=r+n.h&&(t-r)%(n.d||1)==0){if(n.e&&-1!==n.e.indexOf(t-r))continue;return n}}return null}const Qi=Ki("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Wi="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Yi=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Xi=Gi("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),tn=Gi("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),en=Gi("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),rn=Ki("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function nn(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Zi(t);var r;r=e.map((t=>{if(Wi.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Ji(t,Yi);if(e)return[t+e.s];let r=Xi[t];if(r)return r;let i=tn[t];return i?[t+i[0]]:en[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Zi(Hi(e),Di.NFKC),e.forEach((t=>{if(Ji(t,rn))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(Ji(t,Qi))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let i=Hi(e);if("-"===i.substring(0,1)||"--"===i.substring(2,4)||"-"===i.substring(i.length-1))throw new Error("invalid hyphen");if(i.length>63)throw new Error("too long");return i}class on extends yi{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,qi(e))}decode(t){return Vi(super.decode(t))}}class sn extends ai{constructor(t,e){let r=!1;const i=[];t.forEach((t=>{t.dynamic&&(r=!0),i.push(t.type)}));super("tuple","tuple("+i.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,i)=>{let n=r.localName;n&&1===e[n]&&("length"===n&&(n="_length"),null==t[n]&&(t[n]=t[i]))})),Object.freeze(t)}encode(t,e){return di(t,this.coders,e)}decode(t){return t.coerce(this.name,mi(t,this.coders))}}const an=new y($r),hn=new RegExp(/^bytes([0-9]*)$/),un=new RegExp(/^(u?int)([0-9]*)$/);class ln{constructor(t){Nr(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new li(t.name);case"bool":return new gi(t.name);case"string":return new on(t.name);case"bytes":return new vi(t.name);case"array":return new pi(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new sn((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new bi(t.name)}let e=t.type.match(un);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&an.throwArgumentError("invalid "+e[1]+" bit length","param",t),new $i(r/8,"int"===e[1],t.name)}if(e=t.type.match(hn),e){let r=parseInt(e[1]);return(0===r||r>32)&&an.throwArgumentError("invalid bytes length","param",t),new wi(r,t.name)}return an.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new ui(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new hi(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Vr.from(t))));return new sn(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&an.throwError("types/values length mismatch",y.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Vr.from(t)))),i=new sn(r,"_"),n=this._getWriter();return i.encode(n,e),n.data}decode(t,e,r){const i=t.map((t=>this._getCoder(Vr.from(t))));return new sn(i,"_").decode(this._getReader(A(e),r))}}const cn=new ln;function fn(t){return we(qi(t))}const dn=new y($r);class mn extends Br{}class pn extends Br{}class gn extends Br{}class yn extends Br{static isIndexed(t){return!(!t||!t._isIndexed)}}const vn={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function wn(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class bn{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,Nr(this,"fragments",e.map((t=>Gr.from(t))).filter((t=>null!=t))),Nr(this,"_abiCoder",Sr(new.target,"getAbiCoder")()),Nr(this,"functions",{}),Nr(this,"errors",{}),Nr(this,"events",{}),Nr(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void dn.warn("duplicate definition - constructor"):void Nr(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?dn.warn("duplicate definition - "+r):e[r]=t})),this.deploy||Nr(this,"deploy",Yr.from({payable:!1,type:"constructor"})),Nr(this,"_isInterface",!0)}format(t){t||(t=qr.full),t===qr.sighash&&dn.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===qr.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return cn}static getAddress(t){return Ce(t)}static getSighash(t){return T(fn(t.format()),0,4)}static getEventTopic(t){return fn(t.format())}getFunction(t){if(N(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];dn.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?dn.throwArgumentError("no matching function","name",e):r.length>1&&dn.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[Xr.fromString(t).format()];return e||dn.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(N(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];dn.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?dn.throwArgumentError("no matching event","name",e):r.length>1&&dn.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Kr.fromString(t).format()];return e||dn.throwArgumentError("no matching event","signature",t),e}getError(t){if(N(t)){const e=Sr(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}dn.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?dn.throwArgumentError("no matching error","name",e):r.length>1&&dn.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[Xr.fromString(t).format()];return e||dn.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Sr(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Sr(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=A(e);return I(r.slice(0,4))!==this.getSighash(t)&&dn.throwArgumentError(`data signature does not match error ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),I(k([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=A(e);return I(r.slice(0,4))!==this.getSighash(t)&&dn.throwArgumentError(`data signature does not match function ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(k([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=A(e),i=null,n="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=I(r.slice(0,4)),e=vn[t];if(e)o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.signature,e.reason&&(i=o[0]),"Error"===s?n=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(n=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.format()}catch(t){}break}}return dn.throwError("call revert exception"+n,y.errors.CALL_EXCEPTION,{method:t.format(),data:I(e),errorArgs:o,errorName:s,errorSignature:a,reason:i})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&dn.throwError("too many arguments for "+t.format(),y.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const i=(t,e)=>"string"===t.type?fn(e):"bytes"===t.type?we(I(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=br.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),O(I(e),32));for(e.forEach(((e,n)=>{let o=t.inputs[n];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?dn.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>i(o,t)))):r.push(i(o,e)):null!=e&&dn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],i=[],n=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&dn.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(fn(s));else if("bytes"===t.type)r.push(we(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else i.push(t),n.push(s)})),{data:this._abiCoder.encode(i,n),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);N(r[0],32)&&r[0].toLowerCase()===e||dn.throwError("fragment/topic mismatch",y.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let i=[],n=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(i.push(Vr.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(i.push(t),o.push(!1)):(n.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(i,k(r)):null,a=this._abiCoder.decode(n,e,!0),h=[],u=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)h[e]=new yn({_isIndexed:!0,hash:null});else if(o[e])h[e]=new yn({_isIndexed:!0,hash:s[l++]});else try{h[e]=s[l++]}catch(t){h[e]=t}else try{h[e]=a[u++]}catch(t){h[e]=t}if(t.name&&null==h[t.name]){const r=h[e];r instanceof Error?Object.defineProperty(h,t.name,{enumerable:!0,get:()=>{throw wn(`property ${JSON.stringify(t.name)}`,r)}}):h[t.name]=r}}));for(let t=0;t<h.length;t++){const e=h[t];e instanceof Error&&Object.defineProperty(h,t,{enumerable:!0,get:()=>{throw wn(`index ${t}`,e)}})}return Object.freeze(h)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new pn({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:br.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new mn({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=I(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new gn({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var Mn=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var _n=Mn.BN;const En=new y("bignumber/5.6.2"),An={},kn=9007199254740991;let xn=!1;class Nn{constructor(t,e){t!==An&&En.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return In(Rn(this).fromTwos(t))}toTwos(t){return In(Rn(this).toTwos(t))}abs(){return"-"===this._hex[0]?Nn.from(this._hex.substring(1)):this}add(t){return In(Rn(this).add(Rn(t)))}sub(t){return In(Rn(this).sub(Rn(t)))}div(t){return Nn.from(t).isZero()&&Tn("division-by-zero","div"),In(Rn(this).div(Rn(t)))}mul(t){return In(Rn(this).mul(Rn(t)))}mod(t){const e=Rn(t);return e.isNeg()&&Tn("division-by-zero","mod"),In(Rn(this).umod(e))}pow(t){const e=Rn(t);return e.isNeg()&&Tn("negative-power","pow"),In(Rn(this).pow(e))}and(t){const e=Rn(t);return(this.isNegative()||e.isNeg())&&Tn("unbound-bitwise-result","and"),In(Rn(this).and(e))}or(t){const e=Rn(t);return(this.isNegative()||e.isNeg())&&Tn("unbound-bitwise-result","or"),In(Rn(this).or(e))}xor(t){const e=Rn(t);return(this.isNegative()||e.isNeg())&&Tn("unbound-bitwise-result","xor"),In(Rn(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Tn("negative-width","mask"),In(Rn(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Tn("negative-width","shl"),In(Rn(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Tn("negative-width","shr"),In(Rn(this).shrn(t))}eq(t){return Rn(this).eq(Rn(t))}lt(t){return Rn(this).lt(Rn(t))}lte(t){return Rn(this).lte(Rn(t))}gt(t){return Rn(this).gt(Rn(t))}gte(t){return Rn(this).gte(Rn(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Rn(this).isZero()}toNumber(){try{return Rn(this).toNumber()}catch(t){Tn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return En.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?xn||(xn=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Rn(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Nn)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Nn(An,Sn(t)):t.match(/^-?[0-9]+$/)?new Nn(An,Sn(new _n(t))):En.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Tn("underflow","BigNumber.from",t),(t>=kn||t<=-kn)&&Tn("overflow","BigNumber.from",t),Nn.from(String(t));const e=t;if("bigint"==typeof e)return Nn.from(e.toString());if(E(e))return Nn.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Nn.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return Nn.from(t)}return En.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Sn(t){if("string"!=typeof t)return Sn(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&En.throwArgumentError("invalid hex","value",t),"0x00"===(t=Sn(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 In(t){return Nn.from(Sn(t))}function Rn(t){const e=Nn.from(t).toHexString();return"-"===e[0]?new _n("-"+e.substring(3),16):new _n(e.substring(2),16)}function Tn(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),En.throwError(t,y.errors.NUMERIC_FAULT,i)}var Cn=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Pn=new y("abstract-provider/5.6.1");class On extends Br{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Bn{constructor(){Pn.checkAbstract(new.target,Bn),Nr(this,"_isProvider",!0)}getFeeData(){return Cn(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield Ir({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let r=null,i=null;return t&&t.baseFeePerGas&&(i=Nn.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var $n=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Un=new y("abstract-signer/5.6.2"),Dn=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Ln=[y.errors.INSUFFICIENT_FUNDS,y.errors.NONCE_EXPIRED,y.errors.REPLACEMENT_UNDERPRICED];class Fn{constructor(){Un.checkAbstract(new.target,Fn),Nr(this,"_isSigner",!0)}getBalance(t){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return $n(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Ir(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return $n(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield Ir(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return $n(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return $n(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return $n(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===Dn.indexOf(e)&&Un.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=Rr(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&Un.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return $n(this,void 0,void 0,(function*(){const e=yield Ir(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>$n(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&Un.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||Un.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):Un.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&Un.throwError("network does not support EIP-1559",y.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):Un.throwError("failed to get consistent fee data",y.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(Ln.indexOf(t.code)>=0)throw t;return Un.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&Un.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Ir(e)}))}_checkProvider(t){this.provider||Un.throwError("missing provider",y.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class jn extends Fn{constructor(t,e){super(),Nr(this,"address",t),Nr(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{Un.throwError(t,y.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new jn(this.address,t)}}var zn=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var qn=zn.BN;const Hn=new y("bignumber/5.6.2"),Vn={},Zn=9007199254740991;let Gn=!1;class Kn{constructor(t,e){t!==Vn&&Hn.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Qn(Wn(this).fromTwos(t))}toTwos(t){return Qn(Wn(this).toTwos(t))}abs(){return"-"===this._hex[0]?Kn.from(this._hex.substring(1)):this}add(t){return Qn(Wn(this).add(Wn(t)))}sub(t){return Qn(Wn(this).sub(Wn(t)))}div(t){return Kn.from(t).isZero()&&Yn("division-by-zero","div"),Qn(Wn(this).div(Wn(t)))}mul(t){return Qn(Wn(this).mul(Wn(t)))}mod(t){const e=Wn(t);return e.isNeg()&&Yn("division-by-zero","mod"),Qn(Wn(this).umod(e))}pow(t){const e=Wn(t);return e.isNeg()&&Yn("negative-power","pow"),Qn(Wn(this).pow(e))}and(t){const e=Wn(t);return(this.isNegative()||e.isNeg())&&Yn("unbound-bitwise-result","and"),Qn(Wn(this).and(e))}or(t){const e=Wn(t);return(this.isNegative()||e.isNeg())&&Yn("unbound-bitwise-result","or"),Qn(Wn(this).or(e))}xor(t){const e=Wn(t);return(this.isNegative()||e.isNeg())&&Yn("unbound-bitwise-result","xor"),Qn(Wn(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Yn("negative-width","mask"),Qn(Wn(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Yn("negative-width","shl"),Qn(Wn(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Yn("negative-width","shr"),Qn(Wn(this).shrn(t))}eq(t){return Wn(this).eq(Wn(t))}lt(t){return Wn(this).lt(Wn(t))}lte(t){return Wn(this).lte(Wn(t))}gt(t){return Wn(this).gt(Wn(t))}gte(t){return Wn(this).gte(Wn(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Wn(this).isZero()}toNumber(){try{return Wn(this).toNumber()}catch(t){Yn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Hn.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Gn||(Gn=!0,Hn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Hn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Hn.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Wn(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Kn)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Kn(Vn,Jn(t)):t.match(/^-?[0-9]+$/)?new Kn(Vn,Jn(new qn(t))):Hn.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Yn("underflow","BigNumber.from",t),(t>=Zn||t<=-Zn)&&Yn("overflow","BigNumber.from",t),Kn.from(String(t));const e=t;if("bigint"==typeof e)return Kn.from(e.toString());if(E(e))return Kn.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Kn.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return Kn.from(t)}return Hn.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Jn(t){if("string"!=typeof t)return Jn(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Hn.throwArgumentError("invalid hex","value",t),"0x00"===(t=Jn(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 Qn(t){return Kn.from(Jn(t))}function Wn(t){const e=Kn.from(t).toHexString();return"-"===e[0]?new qn("-"+e.substring(3),16):new qn(e.substring(2),16)}function Yn(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Hn.throwError(t,y.errors.NUMERIC_FAULT,i)}var Xn=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var to=Xn.BN;const eo=new y("bignumber/5.6.2"),ro={},io=9007199254740991;let no=!1;class oo{constructor(t,e){t!==ro&&eo.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ao(ho(this).fromTwos(t))}toTwos(t){return ao(ho(this).toTwos(t))}abs(){return"-"===this._hex[0]?oo.from(this._hex.substring(1)):this}add(t){return ao(ho(this).add(ho(t)))}sub(t){return ao(ho(this).sub(ho(t)))}div(t){return oo.from(t).isZero()&&uo("division-by-zero","div"),ao(ho(this).div(ho(t)))}mul(t){return ao(ho(this).mul(ho(t)))}mod(t){const e=ho(t);return e.isNeg()&&uo("division-by-zero","mod"),ao(ho(this).umod(e))}pow(t){const e=ho(t);return e.isNeg()&&uo("negative-power","pow"),ao(ho(this).pow(e))}and(t){const e=ho(t);return(this.isNegative()||e.isNeg())&&uo("unbound-bitwise-result","and"),ao(ho(this).and(e))}or(t){const e=ho(t);return(this.isNegative()||e.isNeg())&&uo("unbound-bitwise-result","or"),ao(ho(this).or(e))}xor(t){const e=ho(t);return(this.isNegative()||e.isNeg())&&uo("unbound-bitwise-result","xor"),ao(ho(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&uo("negative-width","mask"),ao(ho(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&uo("negative-width","shl"),ao(ho(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&uo("negative-width","shr"),ao(ho(this).shrn(t))}eq(t){return ho(this).eq(ho(t))}lt(t){return ho(this).lt(ho(t))}lte(t){return ho(this).lte(ho(t))}gt(t){return ho(this).gt(ho(t))}gte(t){return ho(this).gte(ho(t))}isNegative(){return"-"===this._hex[0]}isZero(){return ho(this).isZero()}toNumber(){try{return ho(this).toNumber()}catch(t){uo("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return eo.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?no||(no=!0,eo.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?eo.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):eo.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),ho(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof oo)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new oo(ro,so(t)):t.match(/^-?[0-9]+$/)?new oo(ro,so(new to(t))):eo.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&uo("underflow","BigNumber.from",t),(t>=io||t<=-io)&&uo("overflow","BigNumber.from",t),oo.from(String(t));const e=t;if("bigint"==typeof e)return oo.from(e.toString());if(E(e))return oo.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return oo.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return oo.from(t)}return eo.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function so(t){if("string"!=typeof t)return so(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&eo.throwArgumentError("invalid hex","value",t),"0x00"===(t=so(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 ao(t){return oo.from(so(t))}function ho(t){const e=oo.from(t).toHexString();return"-"===e[0]?new to("-"+e.substring(3),16):new to(e.substring(2),16)}function uo(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),eo.throwError(t,y.errors.NUMERIC_FAULT,i)}var lo=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)})),co=fo;function fo(t,e){if(!t)throw new Error(e||"Assertion failed")}function mo(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function po(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function go(t){return 1===t.length?"0"+t:t}function yo(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}fo.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var vo={inherits:o((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}}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):mo(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},toHex:function(t){for(var e="",r=0;r<t.length;r++)e+=go(t[r].toString(16));return e},htonl:po,toHex32:function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=po(n)),r+=yo(n.toString(16))}return r},zero2:go,zero8:yo,join32:function(t,e,r,i){var n=r-e;co(n%4==0);for(var o=new Array(n/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},split32:function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var o=t[i];"big"===e?(r[n]=o>>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<<e|t>>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,r){return t+e+r>>>0},sum32_4:function(t,e,r,i){return t+e+r+i>>>0},sum32_5:function(t,e,r,i,n){return t+e+r+i+n>>>0},sum64:function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o<i?1:0)+r+n;t[e]=s>>>0,t[e+1]=o},sum64_hi:function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},sum64_lo:function(t,e,r,i){return e+i>>>0},sum64_4_hi:function(t,e,r,i,n,o,s,a){var h=0,u=e;return h+=(u=u+i>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+n+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},sum64_5_hi:function(t,e,r,i,n,o,s,a,h,u){var l=0,c=e;return l+=(c=c+i>>>0)<e?1:0,l+=(c=c+o>>>0)<o?1:0,l+=(c=c+a>>>0)<a?1:0,t+r+n+s+h+(l+=(c=c+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(t,e,r,i,n,o,s,a,h,u){return e+i+o+a+u>>>0},rotr64_hi:function(t,e,r){return(e<<32-r|t>>>r)>>>0},rotr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0},shr64_hi:function(t,e,r){return t>>>r},shr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0}};function wo(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var bo=wo;wo.prototype.update=function(t,e){if(t=vo.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=vo.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},wo.prototype.digest=function(t){return this.update(this._pad()),co(null===this.pending),this._digest(t)},wo.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o<this.padLength;o++)i[n++]=0;return i};var Mo={BlockHash:bo},_o=vo.rotr32;var Eo=function(t,e,r,i){return 0===t?Ao(e,r,i):1===t||3===t?xo(e,r,i):2===t?ko(e,r,i):void 0};function Ao(t,e,r){return t&e^~t&r}function ko(t,e,r){return t&e^t&r^e&r}function xo(t,e,r){return t^e^r}var No=function(t){return _o(t,2)^_o(t,13)^_o(t,22)};var So=function(t){return _o(t,6)^_o(t,11)^_o(t,25)};var Io=function(t){return _o(t,7)^_o(t,18)^t>>>3};var Ro=function(t){return _o(t,17)^_o(t,19)^t>>>10},To={ft_1:Eo,ch32:Ao,maj32:ko,p32:xo,s0_256:No,s1_256:So,g0_256:Io,g1_256:Ro},Co=vo.rotl32,Po=vo.sum32,Oo=vo.sum32_5,Bo=To.ft_1,$o=Mo.BlockHash,Uo=[1518500249,1859775393,2400959708,3395469782];function Do(){if(!(this instanceof Do))return new Do;$o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}vo.inherits(Do,$o);var Lo=Do;Do.blockSize=512,Do.outSize=160,Do.hmacStrength=80,Do.padLength=64,Do.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Co(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var u=~~(i/20),l=Oo(Co(n,5),Bo(u,o,s,a),h,r[i],Uo[u]);h=a,a=s,s=Co(o,30),o=n,n=l}this.h[0]=Po(this.h[0],n),this.h[1]=Po(this.h[1],o),this.h[2]=Po(this.h[2],s),this.h[3]=Po(this.h[3],a),this.h[4]=Po(this.h[4],h)},Do.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"big"):vo.split32(this.h,"big")};var Fo=vo.sum32,jo=vo.sum32_4,zo=vo.sum32_5,qo=To.ch32,Ho=To.maj32,Vo=To.s0_256,Zo=To.s1_256,Go=To.g0_256,Ko=To.g1_256,Jo=Mo.BlockHash,Qo=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Wo(){if(!(this instanceof Wo))return new Wo;Jo.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Qo,this.W=new Array(64)}vo.inherits(Wo,Jo);var Yo=Wo;function Xo(){if(!(this instanceof Xo))return new Xo;Yo.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Wo.blockSize=512,Wo.outSize=256,Wo.hmacStrength=192,Wo.padLength=64,Wo.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=jo(Ko(r[i-2]),r[i-7],Go(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],l=this.h[6],c=this.h[7];for(co(this.k.length===r.length),i=0;i<r.length;i++){var f=zo(c,Zo(h),qo(h,u,l),this.k[i],r[i]),d=Fo(Vo(n),Ho(n,o,s));c=l,l=u,u=h,h=Fo(a,f),a=s,s=o,o=n,n=Fo(f,d)}this.h[0]=Fo(this.h[0],n),this.h[1]=Fo(this.h[1],o),this.h[2]=Fo(this.h[2],s),this.h[3]=Fo(this.h[3],a),this.h[4]=Fo(this.h[4],h),this.h[5]=Fo(this.h[5],u),this.h[6]=Fo(this.h[6],l),this.h[7]=Fo(this.h[7],c)},Wo.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"big"):vo.split32(this.h,"big")},vo.inherits(Xo,Yo);var ts=Xo;Xo.blockSize=512,Xo.outSize=224,Xo.hmacStrength=192,Xo.padLength=64,Xo.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h.slice(0,7),"big"):vo.split32(this.h.slice(0,7),"big")};var es=vo.rotr64_hi,rs=vo.rotr64_lo,is=vo.shr64_hi,ns=vo.shr64_lo,os=vo.sum64,ss=vo.sum64_hi,as=vo.sum64_lo,hs=vo.sum64_4_hi,us=vo.sum64_4_lo,ls=vo.sum64_5_hi,cs=vo.sum64_5_lo,fs=Mo.BlockHash,ds=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ms(){if(!(this instanceof ms))return new ms;fs.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ds,this.W=new Array(160)}vo.inherits(ms,fs);var ps=ms;function gs(t,e,r,i,n){var o=t&r^~t&n;return o<0&&(o+=4294967296),o}function ys(t,e,r,i,n,o){var s=e&i^~e&o;return s<0&&(s+=4294967296),s}function vs(t,e,r,i,n){var o=t&r^t&n^r&n;return o<0&&(o+=4294967296),o}function ws(t,e,r,i,n,o){var s=e&i^e&o^i&o;return s<0&&(s+=4294967296),s}function bs(t,e){var r=es(t,e,28)^es(e,t,2)^es(e,t,7);return r<0&&(r+=4294967296),r}function Ms(t,e){var r=rs(t,e,28)^rs(e,t,2)^rs(e,t,7);return r<0&&(r+=4294967296),r}function _s(t,e){var r=es(t,e,14)^es(t,e,18)^es(e,t,9);return r<0&&(r+=4294967296),r}function Es(t,e){var r=rs(t,e,14)^rs(t,e,18)^rs(e,t,9);return r<0&&(r+=4294967296),r}function As(t,e){var r=es(t,e,1)^es(t,e,8)^is(t,e,7);return r<0&&(r+=4294967296),r}function ks(t,e){var r=rs(t,e,1)^rs(t,e,8)^ns(t,e,7);return r<0&&(r+=4294967296),r}function xs(t,e){var r=es(t,e,19)^es(e,t,29)^is(t,e,6);return r<0&&(r+=4294967296),r}function Ns(t,e){var r=rs(t,e,19)^rs(e,t,29)^ns(t,e,6);return r<0&&(r+=4294967296),r}function Ss(){if(!(this instanceof Ss))return new Ss;ps.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ms.blockSize=1024,ms.outSize=512,ms.hmacStrength=192,ms.padLength=128,ms.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=xs(r[i-4],r[i-3]),o=Ns(r[i-4],r[i-3]),s=r[i-14],a=r[i-13],h=As(r[i-30],r[i-29]),u=ks(r[i-30],r[i-29]),l=r[i-32],c=r[i-31];r[i]=hs(n,o,s,a,h,u,l,c),r[i+1]=us(n,o,s,a,h,u,l,c)}},ms.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],l=this.h[7],c=this.h[8],f=this.h[9],d=this.h[10],m=this.h[11],p=this.h[12],g=this.h[13],y=this.h[14],v=this.h[15];co(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var b=y,M=v,_=_s(c,f),E=Es(c,f),A=gs(c,f,d,m,p),k=ys(c,f,d,m,p,g),x=this.k[w],N=this.k[w+1],S=r[w],I=r[w+1],R=ls(b,M,_,E,A,k,x,N,S,I),T=cs(b,M,_,E,A,k,x,N,S,I);b=bs(i,n),M=Ms(i,n),_=vs(i,n,o,s,a),E=ws(i,n,o,s,a,h);var C=ss(b,M,_,E),P=as(b,M,_,E);y=p,v=g,p=d,g=m,d=c,m=f,c=ss(u,l,R,T),f=as(l,l,R,T),u=a,l=h,a=o,h=s,o=i,s=n,i=ss(R,T,C,P),n=as(R,T,C,P)}os(this.h,0,i,n),os(this.h,2,o,s),os(this.h,4,a,h),os(this.h,6,u,l),os(this.h,8,c,f),os(this.h,10,d,m),os(this.h,12,p,g),os(this.h,14,y,v)},ms.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"big"):vo.split32(this.h,"big")},vo.inherits(Ss,ps);var Is=Ss;Ss.blockSize=1024,Ss.outSize=384,Ss.hmacStrength=192,Ss.padLength=128,Ss.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h.slice(0,12),"big"):vo.split32(this.h.slice(0,12),"big")};var Rs={sha1:Lo,sha224:ts,sha256:Yo,sha384:Is,sha512:ps},Ts=vo.rotl32,Cs=vo.sum32,Ps=vo.sum32_3,Os=vo.sum32_4,Bs=Mo.BlockHash;function $s(){if(!(this instanceof $s))return new $s;Bs.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}vo.inherits($s,Bs);var Us=$s;function Ds(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Ls(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Fs(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}$s.blockSize=512,$s.outSize=160,$s.hmacStrength=192,$s.padLength=64,$s.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],o=this.h[3],s=this.h[4],a=r,h=i,u=n,l=o,c=s,f=0;f<80;f++){var d=Cs(Ts(Os(r,Ds(f,i,n,o),t[js[f]+e],Ls(f)),qs[f]),s);r=s,s=o,o=Ts(n,10),n=i,i=d,d=Cs(Ts(Os(a,Ds(79-f,h,u,l),t[zs[f]+e],Fs(f)),Hs[f]),c),a=c,c=l,l=Ts(u,10),u=h,h=d}d=Ps(this.h[1],n,l),this.h[1]=Ps(this.h[2],o,c),this.h[2]=Ps(this.h[3],s,a),this.h[3]=Ps(this.h[4],r,h),this.h[4]=Ps(this.h[0],i,u),this.h[0]=d},$s.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"little"):vo.split32(this.h,"little")};var js=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zs=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],qs=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Hs=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Vs={ripemd160:Us};function Zs(t,e,r){if(!(this instanceof Zs))return new Zs(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(vo.toArray(e,r))}var Gs=Zs;Zs.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),co(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Zs.prototype.update=function(t,e){return this.inner.update(t,e),this},Zs.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var Ks=o((function(t,e){var r=e;r.utils=vo,r.common=Mo,r.sha=Rs,r.ripemd=Vs,r.hmac=Gs,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}));function Js(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}var Qs=Ws;function Ws(t,e){if(!t)throw new Error(e||"Assertion failed")}Ws.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Ys=Js((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}})),Xs=Js((function(t,e){var r=e;r.assert=Qs,r.toArray=Ys.toArray,r.zero2=Ys.zero2,r.toHex=Ys.toHex,r.encode=Ys.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 a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,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,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+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 lo(t,"hex","le")}})),ta=Xs.getNAF,ea=Xs.getJSF,ra=Xs.assert;function ia(t,e){this.type=t,this.p=new lo(e.p,16),this.red=e.prime?lo.red(e.prime):lo.mont(this.p),this.zero=new lo(0).toRed(this.red),this.one=new lo(1).toRed(this.red),this.two=new lo(2).toRed(this.red),this.n=e.n&&new lo(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 na=ia;function oa(t,e){this.curve=t,this.type=e,this.precomputed=null}ia.prototype.point=function(){throw new Error("Not implemented")},ia.prototype.validate=function(){throw new Error("Not implemented")},ia.prototype._fixedNafMul=function(t,e){ra(t.precomputed);var r=t._getDoubles(),i=ta(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),c=n;c>0;c--){for(o=0;o<a.length;o++)(s=a[o])===c?l=l.mixedAdd(r.points[o]):s===-c&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},ia.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=ta(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];ra(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},ia.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,c=0;for(o=0;o<i;o++){var f=(a=e[o])._getNAFPoints(t);h[o]=f.wnd,u[o]=f.points}for(o=i-1;o>=1;o-=2){var d=o-1,m=o;if(1===h[d]&&1===h[m]){var p=[e[d],null,null,e[m]];0===e[d].y.cmp(e[m].y)?(p[1]=e[d].add(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg())):0===e[d].y.cmp(e[m].y.redNeg())?(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].add(e[m].neg())):(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=ea(r[d],r[m]);for(c=Math.max(y[0].length,c),l[d]=new Array(c),l[m]=new Array(c),s=0;s<c;s++){var v=0|y[0][s],w=0|y[1][s];l[d][s]=g[3*(v+1)+(w+1)],l[m][s]=0,u[d]=p}}else l[d]=ta(r[d],h[d],this._bitLength),l[m]=ta(r[m],h[m],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[m].length,c)}var b=this.jpoint(null,null,null),M=this._wnafT4;for(o=c;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(s=0;s<i;s++)M[s]=0|l[s][o],0!==M[s]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,b=b.dblp(_),o<0)break;for(s=0;s<i;s++){var A=M[s];0!==A&&(A>0?a=u[s][A-1>>1]:A<0&&(a=u[s][-A-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?b:b.toP()},ia.BasePoint=oa,oa.prototype.eq=function(){throw new Error("Not implemented")},oa.prototype.validate=function(){return this.curve.validate(this)},ia.prototype.decodePoint=function(t,e){t=Xs.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]?ra(t[t.length-1]%2==0):7===t[0]&&ra(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")},oa.prototype.encodeCompressed=function(t){return this.encode(t,!0)},oa.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))},oa.prototype.encode=function(t,e){return Xs.encode(this._encode(e),t)},oa.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},oa.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)},oa.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}},oa.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}},oa.prototype._getBeta=function(){return null},oa.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var sa=Js((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}}})),aa=Xs.assert;function ha(t){na.call(this,"short",t),this.a=new lo(t.a,16).toRed(this.red),this.b=new lo(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)}sa(ha,na);var ua=ha;function la(t,e,r,i){na.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new lo(e,16),this.y=new lo(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 ca(t,e,r,i){na.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new lo(0)):(this.x=new lo(e,16),this.y=new lo(r,16),this.z=new lo(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}ha.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new lo(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 lo(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],aa(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 lo(t.a,16),b:new lo(t.b,16)}})):this._getEndoBasis(r)}}},ha.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:lo.mont(t),r=new lo(2).toRed(e).redInvm(),i=r.redNeg(),n=new lo(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},ha.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,f=this.n.clone(),d=new lo(1),m=new lo(0),p=new lo(0),g=new lo(1),y=0;0!==c.cmpn(0);){var v=f.div(c);h=f.sub(v.mul(c)),u=p.sub(v.mul(d));var w=g.sub(v.mul(m));if(!i&&h.cmp(l)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++y)break;a=h,f=c,c=h,p=d,d=u,g=m,m=w}o=h.neg(),s=u;var b=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(b)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},ha.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),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},ha.prototype.pointFromX=function(t,e){(t=new lo(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},ha.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)},ha.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]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,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},sa(la,na.BasePoint),ha.prototype.point=function(t,e,r){return new la(this,t,e,r)},ha.prototype.pointFromJSON=function(t,e){return la.fromJSON(this,t,e)},la.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}},la.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]},la.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},la.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)+">"},la.prototype.isInfinity=function(){return this.inf},la.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)},la.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)},la.prototype.getX=function(){return this.x.fromRed()},la.prototype.getY=function(){return this.y.fromRed()},la.prototype.mul=function(t){return t=new lo(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)},la.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)},la.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)},la.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))},la.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},la.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},sa(ca,na.BasePoint),ha.prototype.jpoint=function(t,e,r){return new ca(this,t,e,r)},ca.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)},ca.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},ca.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)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=i.redMul(u),f=h.redSqr().redIAdd(l).redISub(c).redISub(c),d=h.redMul(c.redISub(f)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,m)},ca.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),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),c=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(c)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},ca.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,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),c=u.redSqr(),f=c.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(h)),m=o.redMul(c),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),y=d.redMul(g);y=y.redIAdd(y).redISub(f);var v=u.redMul(a);e+1<t&&(h=h.redMul(f)),o=p,a=v,u=y}return this.curve.jpoint(o,u.redMul(n),a)},ca.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},ca.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 a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),c=this.y.redSqr(),f=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(l).redISub(f);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),e=m.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},ca.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 a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),c=this.y.redSqr(),f=this.x.redMul(c),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=f.redIAdd(f),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(l);var g=c.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},ca.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(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),c=u.redISub(l),f=s.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=a.redMul(c).redISub(f),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,d,m)},ca.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),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.x.redMul(a).redISub(l);c=(c=c.redIAdd(c)).redIAdd(c);var f=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,f,d)},ca.prototype.mul=function(t,e){return t=new lo(t,e),this.curve._wnafMul(this,t)},ca.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)},ca.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}},ca.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)+">"},ca.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var fa=Js((function(t,e){var r=e;r.base=na,r.short=ua,r.mont=null,r.edwards=null})),da=Js((function(t,e){var r,i=e,n=Xs.assert;function o(t){"short"===t.type?this.curve=new fa.short(t):"edwards"===t.type?this.curve=new fa.edwards(t):this.curve=new fa.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 s(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,s("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:Ks.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:Ks.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:Ks.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:Ks.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"]}),s("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:Ks.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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ks.sha256,gRed:!1,g:["9"]}),s("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:Ks.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("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:Ks.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function ma(t){if(!(this instanceof ma))return new ma(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=Ys.toArray(t.entropy,t.entropyEnc||"hex"),r=Ys.toArray(t.nonce,t.nonceEnc||"hex"),i=Ys.toArray(t.pers,t.persEnc||"hex");Qs(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var pa=ma;ma.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},ma.prototype._hmac=function(){return new Ks.hmac(this.hash,this.K)},ma.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())},ma.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=Ys.toArray(t,e),r=Ys.toArray(r,i),Qs(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},ma.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=Ys.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++,Ys.encode(o,e)};var ga=Xs.assert;function ya(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 va=ya;ya.fromPublic=function(t,e,r){return e instanceof ya?e:new ya(t,{pub:e,pubEnc:r})},ya.fromPrivate=function(t,e,r){return e instanceof ya?e:new ya(t,{priv:e,privEnc:r})},ya.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"}},ya.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},ya.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},ya.prototype._importPrivate=function(t,e){this.priv=new lo(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},ya.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?ga(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ga(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)},ya.prototype.derive=function(t){return t.validate()||ga(t.validate(),"public point not validated"),t.mul(this.priv).getX()},ya.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},ya.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},ya.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var wa=Xs.assert;function ba(t,e){if(t instanceof ba)return t;this._importDER(t,e)||(wa(t.r&&t.s,"Signature without r or s"),this.r=new lo(t.r,16),this.s=new lo(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Ma=ba;function _a(){this.place=0}function Ea(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 Aa(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 ka(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)}}ba.prototype._importDER=function(t,e){t=Xs.toArray(t,e);var r=new _a;if(48!==t[r.place++])return!1;var i=Ea(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=Ea(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=Ea(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new lo(o),this.s=new lo(a),this.recoveryParam=null,!0},ba.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=Aa(e),r=Aa(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];ka(i,e.length),(i=i.concat(e)).push(2),ka(i,r.length);var n=i.concat(r),o=[48];return ka(o,n.length),o=o.concat(n),Xs.encode(o,t)};var xa=function(){throw new Error("unsupported")},Na=Xs.assert;function Sa(t){if(!(this instanceof Sa))return new Sa(t);"string"==typeof t&&(Na(Object.prototype.hasOwnProperty.call(da,t),"Unknown curve "+t),t=da[t]),t instanceof da.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 Ia=Sa;Sa.prototype.keyPair=function(t){return new va(this,t)},Sa.prototype.keyFromPrivate=function(t,e){return va.fromPrivate(this,t,e)},Sa.prototype.keyFromPublic=function(t,e){return va.fromPublic(this,t,e)},Sa.prototype.genKeyPair=function(t){t||(t={});for(var e=new pa({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||xa(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new lo(2));;){var n=new lo(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Sa.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},Sa.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 lo(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),s=t.toArray("be",n),a=new pa({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new lo(1)),u=0;;u++){var l=i.k?i.k(u):new lo(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var c=this.g.mul(l);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var m=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var p=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),p^=1),new Ma({r:d,s:m,recoveryParam:p})}}}}}},Sa.prototype.verify=function(t,e,r,i){t=this._truncateToN(new lo(t,16)),r=this.keyFromPublic(r,i);var n=(e=new Ma(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),h=a.mul(t).umod(this.n),u=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(n):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(n)},Sa.prototype.recoverPubKey=function(t,e,r,i){Na((3&r)===r,"The recovery param is more than two bits"),e=new Ma(e,i);var n=this.n,o=new lo(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(n),c=n.sub(o).mul(l).umod(n),f=a.mul(l).umod(n);return this.g.mulAdd(c,s,f)},Sa.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new Ma(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 Ra=Js((function(t,e){var r=e;r.version="6.5.4",r.utils=Xs,r.rand=function(){throw new Error("unsupported")},r.curve=fa,r.curves=da,r.ec=Ia,r.eddsa=null})).ec;const Ta=new y("signing-key/5.6.2");let Ca=null;function Pa(){return Ca||(Ca=new Ra("secp256k1")),Ca}class Oa{constructor(t){Nr(this,"curve","secp256k1"),Nr(this,"privateKey",I(t)),32!==R(this.privateKey)&&Ta.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=Pa().keyFromPrivate(A(this.privateKey));Nr(this,"publicKey","0x"+e.getPublic(!1,"hex")),Nr(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Nr(this,"_isSigningKey",!0)}_addPoint(t){const e=Pa().keyFromPublic(A(this.publicKey)),r=Pa().keyFromPublic(A(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Pa().keyFromPrivate(A(this.privateKey)),r=A(t);32!==r.length&&Ta.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return B({recoveryParam:i.recoveryParam,r:O("0x"+i.r.toString(16),32),s:O("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=Pa().keyFromPrivate(A(this.privateKey)),r=Pa().keyFromPublic(A(Ba(t)));return O("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Ba(t,e){const r=A(t);if(32===r.length){const t=new Oa(r);return e?"0x"+Pa().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?I(r):"0x"+Pa().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Pa().keyFromPublic(r).getPublic(!0,"hex"):I(r):Ta.throwArgumentError("invalid public or private key","key","[REDACTED]")}const $a=new y("transactions/5.6.2");var Ua;function Da(t){return"0x"===t?null:Ce(t)}function La(t){return"0x"===t?Pi:oo.from(t)}function Fa(t,e){return function(t){return Ce(T(we(T(Ba(t),1)),12))}(function(t,e){const r=B(e),i={r:A(r.r),s:A(r.s)};return"0x"+Pa().recoverPubKey(A(t),i,r.recoveryParam).encode("hex",!1)}(A(t),e))}function ja(t,e){const r=x(oo.from(t).toHexString());return r.length>32&&$a.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function za(t,e){return{address:Ce(t),storageKeys:(e||[]).map(((e,r)=>(32!==R(e)&&$a.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function qa(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&$a.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),za(t[0],t[1])):za(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return za(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function Ha(t){return qa(t).map((t=>[t.address,t.storageKeys]))}function Va(t,e){if(null!=t.gasPrice){const e=oo.from(t.gasPrice),r=oo.from(t.maxFeePerGas||0);e.eq(r)||$a.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[ja(t.chainId||0,"chainId"),ja(t.nonce||0,"nonce"),ja(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ja(t.maxFeePerGas||0,"maxFeePerGas"),ja(t.gasLimit||0,"gasLimit"),null!=t.to?Ce(t.to):"0x",ja(t.value||0,"value"),t.data||"0x",Ha(t.accessList||[])];if(e){const t=B(e);r.push(ja(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return C(["0x02",Ae(r)])}function Za(t,e){const r=[ja(t.chainId||0,"chainId"),ja(t.nonce||0,"nonce"),ja(t.gasPrice||0,"gasPrice"),ja(t.gasLimit||0,"gasLimit"),null!=t.to?Ce(t.to):"0x",ja(t.value||0,"value"),t.data||"0x",Ha(t.accessList||[])];if(e){const t=B(e);r.push(ja(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return C(["0x01",Ae(r)])}function Ga(t,e,r){try{const r=La(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){$a.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=O(e[1],32),t.s=O(e[2],32);try{const e=we(r(t));t.from=Fa(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function Ka(t){const e=A(t);if(e[0]>127)return function(t){const e=Ne(t);9!==e.length&&6!==e.length&&$a.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:La(e[0]).toNumber(),gasPrice:La(e[1]),gasLimit:La(e[2]),to:Da(e[3]),value:La(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=oo.from(e[6]).toNumber()}catch(t){return r}if(r.r=O(e[7],32),r.s=O(e[8],32),oo.from(r.r).isZero()&&oo.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let i=r.v-27;const n=e.slice(0,6);0!==r.chainId&&(n.push(I(r.chainId)),n.push("0x"),n.push("0x"),i-=2*r.chainId+8);const o=we(Ae(n));try{r.from=Fa(o,{r:I(r.r),s:I(r.s),recoveryParam:i})}catch(t){}r.hash=we(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=Ne(t.slice(1));8!==e.length&&11!==e.length&&$a.throwArgumentError("invalid component count for transaction type: 1","payload",I(t));const r={type:1,chainId:La(e[0]).toNumber(),nonce:La(e[1]).toNumber(),gasPrice:La(e[2]),gasLimit:La(e[3]),to:Da(e[4]),value:La(e[5]),data:e[6],accessList:qa(e[7])};return 8===e.length||(r.hash=we(t),Ga(r,e.slice(8),Za)),r}(e);case 2:return function(t){const e=Ne(t.slice(1));9!==e.length&&12!==e.length&&$a.throwArgumentError("invalid component count for transaction type: 2","payload",I(t));const r=La(e[2]),i=La(e[3]),n={type:2,chainId:La(e[0]).toNumber(),nonce:La(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:i,gasPrice:null,gasLimit:La(e[4]),to:Da(e[5]),value:La(e[6]),data:e[7],accessList:qa(e[8])};return 9===e.length||(n.hash=we(t),Ga(n,e.slice(9),Va)),n}(e)}return $a.throwError(`unsupported transaction type: ${e[0]}`,y.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Ua||(Ua={}));var Ja=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Qa=new y("contracts/5.6.2");function Wa(t,e){return Ja(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&Qa.throwArgumentError("invalid address or ENS name","name",r);try{return Ce(r)}catch(t){}t||Qa.throwError("a provider or signer is needed to resolve ENS names",y.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const i=yield t.resolveName(r);return null==i&&Qa.throwArgumentError("resolver or addr is not configured for ENS name","name",r),i}))}function Ya(t,e,r){return Ja(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,i)=>Ya(t,Array.isArray(e)?e[i]:e[r.name],r)))):"address"===r.type?yield Wa(t,e):"tuple"===r.type?yield Ya(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>Ya(t,e,r.arrayChildren)))):Promise.reject(Qa.makeError("invalid value for array",y.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function Xa(t,e,r){return Ja(this,void 0,void 0,(function*(){let i={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(i=Rr(r.pop())),Qa.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?i.from?i.from=Ir({override:Wa(t.signer,i.from),signer:t.signer.getAddress()}).then((t=>Ja(this,void 0,void 0,(function*(){return Ce(t.signer)!==t.override&&Qa.throwError("Contract with a Signer cannot override from",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):i.from=t.signer.getAddress():i.from&&(i.from=Wa(t.provider,i.from));const n=yield Ir({args:Ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:Ir(i)||{}}),o=t.interface.encodeFunctionData(e,n.args),s={data:o,to:n.address},a=n.overrides;if(null!=a.nonce&&(s.nonce=Kn.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=Kn.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=Kn.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=Kn.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=Kn.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=qa(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=A(o);for(let e=0;e<r.length;e++)t+=4,r[e]&&(t+=64);s.gasLimit=Kn.from(e.gas).add(t)}if(a.value){const t=Kn.from(a.value);t.isZero()||e.payable||Qa.throwError("non-payable method cannot override value",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:i.value}),s.value=t}a.customData&&(s.customData=Rr(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete i.nonce,delete i.gasLimit,delete i.gasPrice,delete i.from,delete i.value,delete i.type,delete i.accessList,delete i.maxFeePerGas,delete i.maxPriorityFeePerGas,delete i.customData,delete i.ccipReadEnabled;const h=Object.keys(i).filter((t=>null!=i[t]));return h.length&&Qa.throwError(`cannot override ${h.map((t=>JSON.stringify(t))).join(",")}`,y.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:h}),s}))}function th(t,e,r){const i=t.signer||t.provider;return function(...n){return Ja(this,void 0,void 0,(function*(){let o;if(n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]){const t=Rr(n.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,n.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield Xa(t,e,n),a=yield i.call(s,o);try{let i=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(i=i[0]),i}catch(e){throw e.code===y.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=n,e.transaction=s),e}}))}}function eh(t,e){return function(...r){return Ja(this,void 0,void 0,(function*(){t.signer||Qa.throwError("sending a transaction requires a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const i=yield Xa(t,e,r),n=yield t.signer.sendTransaction(i);return function(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let i=Or(r),n=null;try{n=t.interface.parseLog(r)}catch(t){}return n&&(i.args=n.args,i.decode=(e,r)=>t.interface.decodeEventLog(n.eventFragment,e,r),i.event=n.name,i.eventSignature=n.signature),i.removeListener=()=>t.provider,i.getBlock=()=>t.provider.getBlock(e.blockHash),i.getTransaction=()=>t.provider.getTransaction(e.transactionHash),i.getTransactionReceipt=()=>Promise.resolve(e),i})),e)))}(t,n),n}))}}function rh(t,e,r){return e.constant?th(t,e,r):eh(t,e)}function ih(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class nh{constructor(t,e){Nr(this,"tag",t),Nr(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class oh extends nh{constructor(){super("error",null)}}class sh extends nh{constructor(t,e,r,i){const n={address:t};let o=e.getEventTopic(r);i?(o!==i[0]&&Qa.throwArgumentError("topic mismatch","topics",i),n.topics=i.slice()):n.topics=[o],super(ih(n),n),Nr(this,"address",t),Nr(this,"interface",e),Nr(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],r=function(t,i){if(Array.isArray(i))for(let n in i){const o=t.slice();o.push(n);try{r(o,i[n])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class ah extends nh{constructor(t,e){super("*",{address:t}),Nr(this,"address",t),Nr(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class hh extends class{constructor(t,e,r){Nr(this,"interface",Sr(new.target,"getInterface")(e)),null==r?(Nr(this,"provider",null),Nr(this,"signer",null)):Fn.isSigner(r)?(Nr(this,"provider",r.provider||null),Nr(this,"signer",r)):Bn.isProvider(r)?(Nr(this,"provider",r),Nr(this,"signer",null)):Qa.throwArgumentError("invalid signer or provider","signerOrProvider",r),Nr(this,"callStatic",{}),Nr(this,"estimateGas",{}),Nr(this,"functions",{}),Nr(this,"populateTransaction",{}),Nr(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];Nr(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?Nr(this.filters,e,this.filters[r[0]]):Qa.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if(Nr(this,"_runningEvents",{}),Nr(this,"_wrappedEmits",{}),null==t&&Qa.throwArgumentError("invalid contract address or ENS name","addressOrName",t),Nr(this,"address",t),this.provider)Nr(this,"resolvedAddress",Wa(this.provider,t));else try{Nr(this,"resolvedAddress",Promise.resolve(Ce(t)))}catch(t){Qa.throwError("provider is required to use ENS name as contract address",y.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const i={},n={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(n[t])Qa.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{n[t]=!0;{const r=e.name;i[`%${r}`]||(i[`%${r}`]=[]),i[`%${r}`].push(t)}null==this[t]&&Nr(this,t,rh(this,e,!0)),null==this.functions[t]&&Nr(this.functions,t,rh(this,e,!1)),null==this.callStatic[t]&&Nr(this.callStatic,t,th(this,e,!0)),null==this.populateTransaction[t]&&Nr(this.populateTransaction,t,function(t,e){return function(...r){return Xa(t,e,r)}}(this,e)),null==this.estimateGas[t]&&Nr(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...i){return Ja(this,void 0,void 0,(function*(){r||Qa.throwError("estimate require a provider or signer",y.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const n=yield Xa(t,e,i);return yield r.estimateGas(n)}))}}(this,e))}})),Object.keys(i).forEach((t=>{const e=i[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&Nr(this,t,this[r])}catch(t){}null==this.functions[t]&&Nr(this.functions,t,this.functions[r]),null==this.callStatic[t]&&Nr(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&Nr(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&Nr(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return Oe(t)}static getInterface(t){return bn.isInterface(t)?t:new bn(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&Qa.throwError("contract not deployed",y.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||Qa.throwError("sending a transactions require a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=Rr(t||{});return["from","to"].forEach((function(t){null!=e[t]&&Qa.throwError("cannot override "+t,y.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new jn(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&Nr(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return yn.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new oh);if("event"===t)return this._normalizeRunningEvent(new nh("event",null));if("*"===t)return this._normalizeRunningEvent(new ah(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new sh(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new sh(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new nh(ih(e),e))}return this._normalizeRunningEvent(new ah(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const i=Or(e);return i.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},i.getBlock=()=>this.provider.getBlock(e.blockHash),i.getTransaction=()=>this.provider.getTransaction(e.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(i),i}_addEventListener(t,e,r){if(this.provider||Qa.throwError("events require a provider or a signer with a provider",y.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let i=this._wrapEvent(t,r,e);if(null==i.decodeError)try{const e=t.getEmit(i);this.emit(t.filter,...e)}catch(t){i.decodeError=t.error}null!=t.filter&&this.emit("event",i),null!=i.decodeError&&this.emit("error",i.decodeError,i)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const i=this._getRunningEvent(t),n=Rr(i.filter);return"string"==typeof e&&N(e,32)?(null!=r&&Qa.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),n.blockHash=e):(n.fromBlock=null!=e?e:0,n.toBlock=null!=r?r:"latest"),this.provider.getLogs(n).then((t=>t.map((t=>this._wrapEvent(i,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),i=r.run(e)>0;return this._checkRunningEvents(r),i}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}{}var uh=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));let lh=!1,ch=!1;const fh={debug:1,default:2,info:2,warning:3,error:4,off:5};let dh=fh.default,mh=null;const ph=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 gh,yh;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(gh||(gh={})),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"}(yh||(yh={}));const vh="0123456789abcdef";class wh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==fh[r]&&this.throwArgumentError("invalid log level name","logLevel",t),dh>fh[r]||console.log.apply(console,e)}debug(...t){this._log(wh.levels.DEBUG,t)}info(...t){this._log(wh.levels.INFO,t)}warn(...t){this._log(wh.levels.WARNING,t)}makeError(t,e,r){if(ch)return this.makeError("censored error",e,{});e||(e=wh.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+=vh[e[t]>>4],r+=vh[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case yh.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case yh.CALL_EXCEPTION:case yh.INSUFFICIENT_FUNDS:case yh.MISSING_NEW:case yh.NONCE_EXPIRED:case yh.REPLACEMENT_UNDERPRICED:case yh.TRANSACTION_REPLACED:case yh.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,wh.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){ph&&this.throwError("platform missing String.prototype.normalize",wh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ph})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,wh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,wh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,wh.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,wh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",wh.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",wh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",wh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return mh||(mh=new wh("logger/5.7.0")),mh}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",wh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),lh){if(!t)return;this.globalLogger().throwError("error censorship permanent",wh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ch=!!t,lh=!!e}static setLogLevel(t){const e=fh[t.toLowerCase()];null!=e?dh=e:wh.globalLogger().warn("invalid log level - "+t)}static from(t){return new wh(t)}}wh.errors=yh,wh.levels=gh;const bh=new wh("bytes/5.7.0");function Mh(t){return!!t.toHexString}function _h(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return _h(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Eh(t){return"number"==typeof t&&t==t&&t%1==0}function Ah(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Eh(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Eh(r)||r<0||r>=256)return!1}return!0}function kh(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const xh="0123456789abcdef";function Nh(t,e){if(e||(e={}),"number"==typeof t){bh.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=xh[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),Mh(t))return t.toHexString();if(kh(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":bh.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ah(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=xh[(240&i)>>4]+xh[15&i]}return e}return bh.throwArgumentError("invalid hexlify value","value",t)}function Sh(t,e){for("string"!=typeof t?t=Nh(t):kh(t)||bh.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&bh.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const Ih="bignumber/5.7.0";var Rh=uh.BN;const Th=new wh(Ih),Ch={},Ph=9007199254740991;let Oh=!1;class Bh{constructor(t,e){t!==Ch&&Th.throwError("cannot call constructor directly; use BigNumber.from",wh.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Uh(Dh(this).fromTwos(t))}toTwos(t){return Uh(Dh(this).toTwos(t))}abs(){return"-"===this._hex[0]?Bh.from(this._hex.substring(1)):this}add(t){return Uh(Dh(this).add(Dh(t)))}sub(t){return Uh(Dh(this).sub(Dh(t)))}div(t){return Bh.from(t).isZero()&&Lh("division-by-zero","div"),Uh(Dh(this).div(Dh(t)))}mul(t){return Uh(Dh(this).mul(Dh(t)))}mod(t){const e=Dh(t);return e.isNeg()&&Lh("division-by-zero","mod"),Uh(Dh(this).umod(e))}pow(t){const e=Dh(t);return e.isNeg()&&Lh("negative-power","pow"),Uh(Dh(this).pow(e))}and(t){const e=Dh(t);return(this.isNegative()||e.isNeg())&&Lh("unbound-bitwise-result","and"),Uh(Dh(this).and(e))}or(t){const e=Dh(t);return(this.isNegative()||e.isNeg())&&Lh("unbound-bitwise-result","or"),Uh(Dh(this).or(e))}xor(t){const e=Dh(t);return(this.isNegative()||e.isNeg())&&Lh("unbound-bitwise-result","xor"),Uh(Dh(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Lh("negative-width","mask"),Uh(Dh(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Lh("negative-width","shl"),Uh(Dh(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Lh("negative-width","shr"),Uh(Dh(this).shrn(t))}eq(t){return Dh(this).eq(Dh(t))}lt(t){return Dh(this).lt(Dh(t))}lte(t){return Dh(this).lte(Dh(t))}gt(t){return Dh(this).gt(Dh(t))}gte(t){return Dh(this).gte(Dh(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Dh(this).isZero()}toNumber(){try{return Dh(this).toNumber()}catch(t){Lh("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Th.throwError("this platform does not support BigInt",wh.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Oh||(Oh=!0,Th.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Th.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",wh.errors.UNEXPECTED_ARGUMENT,{}):Th.throwError("BigNumber.toString does not accept parameters",wh.errors.UNEXPECTED_ARGUMENT,{})),Dh(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Bh)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Bh(Ch,$h(t)):t.match(/^-?[0-9]+$/)?new Bh(Ch,$h(new Rh(t))):Th.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Lh("underflow","BigNumber.from",t),(t>=Ph||t<=-Ph)&&Lh("overflow","BigNumber.from",t),Bh.from(String(t));const e=t;if("bigint"==typeof e)return Bh.from(e.toString());if(Ah(e))return Bh.from(Nh(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Bh.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(kh(t)||"-"===t[0]&&kh(t.substring(1))))return Bh.from(t)}return Th.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function $h(t){if("string"!=typeof t)return $h(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Th.throwArgumentError("invalid hex","value",t),"0x00"===(t=$h(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 Uh(t){return Bh.from($h(t))}function Dh(t){const e=Bh.from(t).toHexString();return"-"===e[0]?new Rh("-"+e.substring(3),16):new Rh(e.substring(2),16)}function Lh(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Th.throwError(t,wh.errors.NUMERIC_FAULT,i)}const Fh=new wh(Ih),jh={},zh=Bh.from(0),qh=Bh.from(-1);function Hh(t,e,r,i){const n={fault:e,operation:r};return void 0!==i&&(n.value=i),Fh.throwError(t,wh.errors.NUMERIC_FAULT,n)}let Vh="0";for(;Vh.length<256;)Vh+=Vh;function Zh(t){if("number"!=typeof t)try{t=Bh.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+Vh.substring(0,t):Fh.throwArgumentError("invalid decimal size","decimals",t)}function Gh(t,e){null==e&&(e=0);const r=Zh(e),i=(t=Bh.from(t)).lt(zh);i&&(t=t.mul(qh));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(r).toString();return t=1===r.length?o:o+"."+n,i&&(t="-"+t),t}function Kh(t,e){null==e&&(e=0);const r=Zh(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||Fh.throwArgumentError("invalid decimal value","value",t);const i="-"===t.substring(0,1);i&&(t=t.substring(1)),"."===t&&Fh.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&Fh.throwArgumentError("too many decimal points","value",t);let o=n[0],s=n[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Hh("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Bh.from(o),h=Bh.from(s);let u=a.mul(r).add(h);return i&&(u=u.mul(qh)),u}class Jh{constructor(t,e,r,i){t!==jh&&Fh.throwError("cannot use FixedFormat constructor; use FixedFormat.from",wh.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=i,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(i),this._multiplier=Zh(i),Object.freeze(this)}static from(t){if(t instanceof Jh)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,i=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const n=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);n||Fh.throwArgumentError("invalid fixed format","format",t),e="u"!==n[1],r=parseInt(n[2]),i=parseInt(n[3])}else if(t){const n=(e,r,i)=>null==t[e]?i:(typeof t[e]!==r&&Fh.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=n("signed","boolean",e),r=n("width","number",r),i=n("decimals","number",i)}return r%8&&Fh.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),i>80&&Fh.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new Jh(jh,e,r,i)}}class Qh{constructor(t,e,r,i){t!==jh&&Fh.throwError("cannot use FixedNumber constructor; use FixedNumber.from",wh.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Fh.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Qh.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(Wh.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Qh.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(Wh.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Fh.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=Qh.from("1"+Vh.substring(0,t),this.format),i=Yh.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&Fh.throwArgumentError("invalid byte width","width",t);return Sh(Bh.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return Qh.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(Bh.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||kh(t)||"bigint"==typeof t||Ah(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),Qh.fromString(Gh(t,e),Jh.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=Jh.from(e),i=Kh(t,r.decimals);!r.signed&&i.lt(zh)&&Hh("unsigned value cannot be negative","overflow","value",t);let n=null;r.signed?n=i.toTwos(r.width).toHexString():(n=i.toHexString(),n=Sh(n,r.width/8));const o=Gh(i,r.decimals);return new Qh(jh,n,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=Jh.from(e);if(function(t,e){if(e||(e={}),"number"==typeof t){bh.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),_h(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Mh(t)&&(t=t.toHexString()),kh(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":bh.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 _h(new Uint8Array(i))}return Ah(t)?_h(new Uint8Array(t)):bh.throwArgumentError("invalid arrayify value","value",t)}(t).length>r.width/8)throw new Error("overflow");let i=Bh.from(t);r.signed&&(i=i.fromTwos(r.width));const n=i.toTwos((r.signed?0:1)+r.width).toHexString(),o=Gh(i,r.decimals);return new Qh(jh,n,o,r)}static from(t,e){if("string"==typeof t)return Qh.fromString(t,e);if(Ah(t))return Qh.fromBytes(t,e);try{return Qh.fromValue(t,0,e)}catch(t){if(t.code!==wh.errors.INVALID_ARGUMENT)throw t}return Fh.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Wh=Qh.from(1),Yh=Qh.from("0.5");let Xh=!1,tu=!1;const eu={debug:1,default:2,info:2,warning:3,error:4,off:5};let ru=eu.default,iu=null;const nu=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 ou,su;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ou||(ou={})),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"}(su||(su={}));const au="0123456789abcdef";class hu{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==eu[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ru>eu[r]||console.log.apply(console,e)}debug(...t){this._log(hu.levels.DEBUG,t)}info(...t){this._log(hu.levels.INFO,t)}warn(...t){this._log(hu.levels.WARNING,t)}makeError(t,e,r){if(tu)return this.makeError("censored error",e,{});e||(e=hu.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+=au[e[t]>>4],r+=au[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case su.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case su.CALL_EXCEPTION:case su.INSUFFICIENT_FUNDS:case su.MISSING_NEW:case su.NONCE_EXPIRED:case su.REPLACEMENT_UNDERPRICED:case su.TRANSACTION_REPLACED:case su.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,hu.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){nu&&this.throwError("platform missing String.prototype.normalize",hu.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:nu})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,hu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,hu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,hu.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,hu.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",hu.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",hu.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",hu.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return iu||(iu=new hu("logger/5.7.0")),iu}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",hu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Xh){if(!t)return;this.globalLogger().throwError("error censorship permanent",hu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}tu=!!t,Xh=!!e}static setLogLevel(t){const e=eu[t.toLowerCase()];null!=e?ru=e:hu.globalLogger().warn("invalid log level - "+t)}static from(t){return new hu(t)}}hu.errors=su,hu.levels=ou;const uu=new hu("units/5.7.0"),lu=["wei","kwei","mwei","gwei","szabo","finney","ether"];let cu=!1,fu=!1;const du={debug:1,default:2,info:2,warning:3,error:4,off:5};let mu=du.default,pu=null;const gu=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 yu,vu;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(yu||(yu={})),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"}(vu||(vu={}));const wu="0123456789abcdef";class bu{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==du[r]&&this.throwArgumentError("invalid log level name","logLevel",t),mu>du[r]||console.log.apply(console,e)}debug(...t){this._log(bu.levels.DEBUG,t)}info(...t){this._log(bu.levels.INFO,t)}warn(...t){this._log(bu.levels.WARNING,t)}makeError(t,e,r){if(fu)return this.makeError("censored error",e,{});e||(e=bu.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+=wu[e[t]>>4],r+=wu[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case vu.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case vu.CALL_EXCEPTION:case vu.INSUFFICIENT_FUNDS:case vu.MISSING_NEW:case vu.NONCE_EXPIRED:case vu.REPLACEMENT_UNDERPRICED:case vu.TRANSACTION_REPLACED:case vu.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,bu.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){gu&&this.throwError("platform missing String.prototype.normalize",bu.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gu})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,bu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,bu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,bu.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,bu.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",bu.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",bu.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",bu.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return pu||(pu=new bu("logger/5.7.0")),pu}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",bu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),cu){if(!t)return;this.globalLogger().throwError("error censorship permanent",bu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fu=!!t,cu=!!e}static setLogLevel(t){const e=du[t.toLowerCase()];null!=e?mu=e:bu.globalLogger().warn("invalid log level - "+t)}static from(t){return new bu(t)}}bu.errors=vu,bu.levels=yu;const Mu=new bu("bytes/5.7.0");function _u(t){return!!t.toHexString}function Eu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Eu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Au(t){return"number"==typeof t&&t==t&&t%1==0}function ku(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Au(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Au(r)||r<0||r>=256)return!1}return!0}function xu(t,e){if(e||(e={}),"number"==typeof t){Mu.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),Eu(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),_u(t)&&(t=t.toHexString()),Su(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Mu.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 Eu(new Uint8Array(i))}return ku(t)?Eu(new Uint8Array(t)):Mu.throwArgumentError("invalid arrayify value","value",t)}function Nu(t){const e=t.map((t=>xu(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),Eu(i)}function Su(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Iu="0123456789abcdef";function Ru(t,e){if(e||(e={}),"number"==typeof t){Mu.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Iu[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),_u(t))return t.toHexString();if(Su(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Mu.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ku(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=Iu[(240&i)>>4]+Iu[15&i]}return e}return Mu.throwArgumentError("invalid hexlify value","value",t)}function Tu(t){let e="0x";return t.forEach((t=>{e+=Ru(t).substring(2)})),e}function Cu(t,e){for("string"!=typeof t?t=Ru(t):Su(t)||Mu.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Mu.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Pu(t){return"0x"+ve.keccak_256(xu(t))}const Ou=new bu("strings/5.7.0");var Bu,$u;function Uu(t,e,r,i,n){if(t===$u.BAD_PREFIX||t===$u.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===$u.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Bu||(Bu={})),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"}($u||($u={}));const Du=Object.freeze({error:function(t,e,r,i,n){return Ou.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Uu,replace:function(t,e,r,i,n){return t===$u.OVERLONG?(i.push(n),0):(i.push(65533),Uu(t,e,r))}});function Lu(t,e){null==e&&(e=Du.error),t=xu(t);const r=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,s=null;if(192==(224&n))o=1,s=127;else if(224==(240&n))o=2,s=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?$u.UNEXPECTED_CONTINUE:$u.BAD_PREFIX,i-1,t,r);continue}o=3,s=65535}if(i-1+o>=t.length){i+=e($u.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let n=0;n<o;n++){let n=t[i];if(128!=(192&n)){i+=e($u.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|63&n,i++}null!==a&&(a>1114111?i+=e($u.OUT_OF_RANGE,i-1-o,t,r,a):a>=55296&&a<=57343?i+=e($u.UTF16_SURROGATE,i-1-o,t,r,a):a<=s?i+=e($u.OVERLONG,i-1-o,t,r,a):r.push(a))}return r}function Fu(t,e=Bu.current){e!=Bu.current&&(Ou.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return xu(r)}function ju(t,e){return Lu(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function zu(t){return Pu(Fu(t))}const qu="hash/5.7.0";function Hu(t,e){null==e&&(e=1);const r=[],i=r.forEach,n=function(t,e){i.call(t,(function(t){e>0&&Array.isArray(t)?n(t,e-1):r.push(t)}))};return n(t,e),r}function Vu(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,o=[0,1];for(let t=1;t<i;t++)o.push(n+=r());let s=r(),a=e;e+=s;let h=0,u=0;function l(){return 0==h&&(u=u<<8|t[e++],h=8),u>>--h&1}const c=Math.pow(2,31),f=c>>>1,d=f>>1,m=c-1;let p=0;for(let t=0;t<31;t++)p=p<<1|l();let g=[],y=0,v=c;for(;;){let t=Math.floor(((p-y+1)*n-1)/v),e=0,r=i;for(;r-e>1;){let i=e+r>>>1;t<o[i]?r=i:e=i}if(0==e)break;g.push(e);let s=y+Math.floor(v*o[e]/n),a=y+Math.floor(v*o[e+1]/n)-1;for(;0==((s^a)&f);)p=p<<1&m|l(),s=s<<1&m,a=a<<1&m|1;for(;s&~a&d;)p=p&f|p<<1&m>>>1|l(),s=s<<1^f,a=(a^f)<<1|f|1;y=s,v=1+a-s}let w=i-4;return g.map((e=>{switch(e-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return e-1}}))}(t))}function Zu(t){return 1&t?~t>>1:t>>1}function Gu(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function Ku(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=Zu(e());return r}function Ju(t,e){let r=Gu(t(),t),i=t(),n=Gu(i,t),o=function(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}(i,t);for(let t=0;t<i;t++)for(let e=0;e<o[t];e++)r.push(n[t]+e);return e?r.map((t=>e[t])):r}function Qu(t,e,r){let i=Array(t).fill(void 0).map((()=>[]));for(let n=0;n<e;n++)Ku(t,r).forEach(((t,e)=>i[e].push(t)));return i}function Wu(t,e){let r=1+e(),i=e(),n=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return Hu(Qu(n.length,1+t,e).map(((t,e)=>{const o=t[0],s=t.slice(1);return Array(n[e]).fill(void 0).map(((t,e)=>{let n=e*i;return[o+e*r,s.map((t=>t+n))]}))})))}function Yu(t,e){return Qu(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Xu=Vu(function(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return xu(e)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),tl=new Set(Ju(Xu)),el=new Set(Ju(Xu)),rl=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(Wu(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Yu(r,t))}return function(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}(Hu(e))}(Xu),il=function(t){let e=Ju(t).sort(((t,e)=>t-e));return function r(){let i=[];for(;;){let n=Ju(t,e);if(0==n.length)break;i.push({set:new Set(n),node:r()})}i.sort(((t,e)=>e.set.size-t.set.size));let n=t(),o=n%3;n=n/3|0;let s=!!(1&n);return n>>=1,{branches:i,valid:o,fe0f:s,save:1==n,check:2==n}}()}(Xu);function nl(t){return function(t,e=Bu.current){return Lu(Fu(t,e))}(t)}function ol(t){return t.filter((t=>65039!=t))}function sl(t){for(let e of t.split(".")){let t=nl(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function al(t){return sl(function(t,e){let r=nl(t).reverse(),i=[];for(;r.length;){let t=hl(r);if(t){i.push(...e(t));continue}let n=r.pop();if(tl.has(n)){i.push(n);continue}if(el.has(n))continue;let o=rl[n];if(!o)throw new Error(`Disallowed codepoint: 0x${n.toString(16).toUpperCase()}`);i.push(...o)}return sl(function(t){return t.normalize("NFC")}(String.fromCodePoint(...i)))}(t,ol))}function hl(t,e){var r;let i,n,o=il,s=[],a=t.length;for(e&&(e.length=0);a;){let h=t[--a];if(o=null===(r=o.branches.find((t=>t.set.has(h))))||void 0===r?void 0:r.node,!o)break;if(o.save)n=h;else if(o.check&&h===n)break;s.push(h),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(i=s.slice(),2==o.valid&&i.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return i}const ul=new bu(qu),ll=new Uint8Array(32);function cl(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function fl(t){const e=Fu(al(t)),r=[];if(0===t.length)return r;let i=0;for(let t=0;t<e.length;t++){46===e[t]&&(r.push(cl(e.slice(i,t))),i=t+1)}if(i>=e.length)throw new Error("invalid ENS name; empty component");return r.push(cl(e.slice(i))),r}function dl(t){return fl(t).map((t=>ju(t))).join(".")}function ml(t){"string"!=typeof t&&ul.throwArgumentError("invalid ENS name; not a string","name",t);let e=ll;const r=fl(t);for(;r.length;)e=Pu(Nu([e,Pu(r.pop())]));return Ru(e)}ll.fill(0);const pl=new bu("address/5.7.0");function gl(t){Su(t,20)||pl.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=xu(Pu(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const yl={};for(let t=0;t<10;t++)yl[String(t)]=String(t);for(let t=0;t<26;t++)yl[String.fromCharCode(65+t)]=String(10+t);const vl=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function wl(t){let e=null;if("string"!=typeof t&&pl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=gl(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&pl.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)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>yl[t])).join("");for(;e.length>=vl;){let t=e.substring(0,vl);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}(t)&&pl.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Rh(r,36).toString(16);e.length<40;)e="0"+e;e=gl("0x"+e)}else pl.throwArgumentError("invalid address","address",t);var r;return e}window&&window.__awaiter;const bl=new bu("properties/5.7.0");function Ml(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function _l(t){const e={};for(const r in t)e[r]=t[r];return e}const El={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Al(t){if(null==t||El[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch(t){continue}if(!Al(i))return!1}return!0}return bl.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function kl(t){if(Al(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>xl(t))));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&Ml(e,r,xl(i))}return e}return bl.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function xl(t){return kl(t)}var Nl=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Sl=new bu(qu),Il=new Uint8Array(32);Il.fill(0);const Rl=Bh.from(-1),Tl=Bh.from(0),Cl=Bh.from(1),Pl=Bh.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ol=Cu(Cl.toHexString(),32),Bl=Cu(Tl.toHexString(),32),$l={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ul=["name","version","chainId","verifyingContract","salt"];function Dl(t){return function(e){return"string"!=typeof e&&Sl.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Ll={name:Dl("name"),version:Dl("version"),chainId:function(t){try{return Bh.from(t).toString()}catch(t){}return Sl.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return wl(t).toLowerCase()}catch(t){}return Sl.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=xu(t);if(32!==e.length)throw new Error("bad length");return Ru(e)}catch(t){}return Sl.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Fl(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&Sl.throwArgumentError("invalid numeric width","type",t);const n=Pl.mask(r?i-1:i),o=r?n.add(Cl).mul(Rl):Tl;return function(e){const r=Bh.from(e);return(r.lt(o)||r.gt(n))&&Sl.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Cu(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Sl.throwArgumentError("invalid bytes width","type",t),function(e){return xu(e).length!==r&&Sl.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=xu(t),r=e.length%32;return r?Tu([e,Il.slice(r)]):Ru(e)}(e)}}}switch(t){case"address":return function(t){return Cu(wl(t),32)};case"bool":return function(t){return t?Ol:Bl};case"bytes":return function(t){return Pu(t)};case"string":return function(t){return zu(t)}}return null}function jl(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class zl{constructor(t){Ml(this,"types",Object.freeze(xl(t))),Ml(this,"_encoderCache",{}),Ml(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&Sl.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&Sl.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);Fl(s)||(r[s]||Sl.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(i),e[i][s]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?Sl.throwArgumentError("missing primary type","types",t):n.length>1&&Sl.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Ml(this,"primaryType",n[0]),function n(o,s){s[o]&&Sl.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,s),Object.keys(s).forEach((e=>{i[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=jl(e,t[e])+r.map((e=>jl(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Fl(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&Sl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(Pu)),Pu(Tu(n))}}const r=this.types[t];if(r){const e=zu(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?Pu(i):i}));return i.unshift(e),Tu(i)}}return Sl.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Sl.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Pu(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Fl(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&Sl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):Sl.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new zl(t)}static getPrimaryType(t){return zl.from(t).primaryType}static hashStruct(t,e,r){return zl.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=$l[r];i||Sl.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>Ul.indexOf(t.name)-Ul.indexOf(e.name))),zl.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Tu(["0x1901",zl.hashDomain(t),zl.from(e).hash(r)])}static hash(t,e,r){return Pu(zl.encode(t,e,r))}static resolveNames(t,e,r,i){return Nl(this,void 0,void 0,(function*(){t=_l(t);const n={};t.verifyingContract&&!Su(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=zl.from(e);o.visit(r,((t,e)=>("address"!==t||Su(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){zl.hashDomain(t);const i={},n=[];Ul.forEach((e=>{const r=t[e];null!=r&&(i[e]=Ll[e](r),n.push({name:e,type:$l[e]}))}));const o=zl.from(e),s=_l(e);return s.EIP712Domain?Sl.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return Ru(xu(e));if(t.match(/^u?int/))return Bh.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Sl.throwArgumentError("invalid string","value",e),e}return Sl.throwArgumentError("unsupported type","type",t)}))}}}var ql=function(t){this.value=t},Hl=Object.defineProperty({EnumType:ql},"__esModule",{value:!0}),Vl=function(){function t(t){this.value=t}return t.prototype.toJSON=function(){return"$"+this.value},t}(),Zl=Object.defineProperty({VariableType:Vl},"__esModule",{value:!0}),Gl=o((function(t,e){function r(t){if(t instanceof Hl.EnumType)return t.value;if(t instanceof Zl.VariableType)return"$"+t.value;if("object"!=typeof t||null===t)return JSON.stringify(t);if(Array.isArray(t))return"["+t.map((function(t){return r(t)})).join(", ")+"]";var e=Object.keys(t).map((function(e){return e+": "+r(t[e])})).join(", ");return"{"+e+"}"}function i(t,r){return-1==e.configFields.indexOf(t)&&-1==r.indexOf(t)}function n(t,e,o,s){Object.keys(t).filter((function(t){return i(t,s.ignoreFields)})).forEach((function(a){var h=t[a];if("object"==typeof h){if(Array.isArray(h)&&!(h=h.find((function(t){return t&&"object"==typeof t}))))return void o.push([""+a,e]);var u=Object.keys(h).filter((function(t){return i(t,s.ignoreFields)})).length>0,l="object"==typeof h.__args&&Object.keys(h.__args).length>0,c="object"==typeof h.__directives,f=h.__all_on instanceof Array,d="object"==typeof h.__on,m=""+a;if("string"==typeof h.__name&&(m=m+" "+h.__name),"string"==typeof h.__aliasFor&&(m=m+": "+h.__aliasFor),"object"==typeof h.__variables&&Object.keys(h.__variables).length>0)m=m+" ("+function(t){var e=[];for(var r in t)e.push("$"+r+": "+t[r]);return e.join(", ")}(h.__variables)+")";else if(l||c){var p="",g="";c&&(g=Object.entries(h.__directives).map((function(t){var e;return"@"+function(t){var e=Object.keys(t)[0],i=t[e];if("boolean"==typeof i||"object"==typeof i&&0===Object.keys(i).length)return e;if("object"==typeof i){var n=[];for(var o in i){var s=r(i[o]).replace(/"/g,"");n.push(o+": "+s)}return e+"("+n.join(", ")+")"}throw new Error("Unsupported type for directive: "+typeof i+". Types allowed: object, boolean.\nOffending object: "+JSON.stringify(t))}(((e={})[t[0]]=t[1],e))})).join(" ")),l&&(p="("+function(t){var e=[];for(var i in t)e.push(i+": "+r(t[i]));return e.join(", ")}(h.__args)+")"),m=m+" "+p+(c&&l?" ":"")+g}if(o.push([m+(u||d||f?" {":""),e]),n(h,e+1,o,s),f&&h.__all_on.forEach((function(t){o.push(["..."+t,e+1])})),d)(h.__on instanceof Array?h.__on:[h.__on]).forEach((function(t){var r=t.__typeName;o.push(["... on "+r+" {",e+1]),n(t,e+2,o,s),o.push(["}",e+1])}));(u||d||f)&&o.push(["}",e])}else(!0===s.includeFalsyKeys||h)&&o.push([""+a,e])}))}Object.defineProperty(e,"__esModule",{value:!0}),e.configFields=["__args","__alias","__aliasFor","__variables","__directives","__on","__all_on","__typeName","__name"],e.jsonToGraphQLQuery=function(t,e){if(void 0===e&&(e={}),!t||"object"!=typeof t)throw new Error("query object not specified");if(0==Object.keys(t).length)throw new Error("query object has no data");e.ignoreFields instanceof Array||(e.ignoreFields=[]);var r=[];n(t,0,r,e);var i="";return r.forEach((function(t){var r=t[0],n=t[1];e.pretty?(i&&(i+="\n"),i+=function(t){return Array(4*t+1).join(" ")}(n)+r):(i&&(i+=" "),i+=r)})),i}})),Kl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(Gl),e.EnumType=Hl.EnumType,e.VariableType=Zl.VariableType})),Jl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class r{}e._CodeOrName=r,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends r{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=i;class n extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const t=this._items[0];return""===t||'""'===t}get str(){var t;return null!==(t=this._str)&&void 0!==t?t:this._str=this._items.reduce(((t,e)=>`${t}${e}`),"")}get names(){var t;return null!==(t=this._names)&&void 0!==t?t:this._names=this._items.reduce(((t,e)=>(e instanceof i&&(t[e.str]=(t[e.str]||0)+1),t)),{})}}function o(t,...e){const r=[t[0]];let i=0;for(;i<e.length;)h(r,e[i]),r.push(t[++i]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(t,...e){const r=[l(t[0])];let i=0;for(;i<e.length;)r.push(s),h(r,e[i]),r.push(s,l(t[++i]));return function(t){let e=1;for(;e<t.length-1;){if(t[e]===s){const r=u(t[e-1],t[e+1]);if(void 0!==r){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}(r),new n(r)}function h(t,e){e instanceof n?t.push(...e._items):e instanceof i?t.push(e):t.push(function(t){return"number"==typeof t||"boolean"==typeof t||null===t?t:l(Array.isArray(t)?t.join(","):t)}(e))}function u(t,e){if('""'===e)return t;if('""'===t)return e;if("string"==typeof t){if(e instanceof i||'"'!==t[t.length-1])return;return"string"!=typeof e?`${t.slice(0,-1)}${e}"`:'"'===e[0]?t.slice(0,-1)+e.slice(1):void 0}return"string"!=typeof e||'"'!==e[0]||t instanceof i?void 0:`"${t}${e.slice(1)}`}function l(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=h,e.strConcat=function(t,e){return e.emptyStr()?t:t.emptyStr()?e:a`${t}${e}`},e.stringify=function(t){return new n(l(t))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(t){return new n(t.toString())}})),Ql=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;class r extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}}var i;!function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"}(i=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new Jl.Name("const"),let:new Jl.Name("let"),var:new Jl.Name("var")};class n{constructor({prefixes:t,parent:e}={}){this._names={},this._prefixes=t,this._parent=e}toName(t){return t instanceof Jl.Name?t:this.name(t)}name(t){return new Jl.Name(this._newName(t))}_newName(t){return`${t}${(this._names[t]||this._nameGroup(t)).index++}`}_nameGroup(t){var e,r;if((null===(r=null===(e=this._parent)||void 0===e?void 0:e._prefixes)||void 0===r?void 0:r.has(t))||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}}e.Scope=n;class o extends Jl.Name{constructor(t,e){super(e),this.prefix=t}setValue(t,{property:e,itemIndex:r}){this.value=t,this.scopePath=Jl._`.${new Jl.Name(e)}[${r}]`}}e.ValueScopeName=o;const s=Jl._`\n`;e.ValueScope=class extends n{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?s:Jl.nil}}get(){return this._scope}name(t){return new o(t,this._newName(t))}value(t,e){var r;if(void 0===e.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(t),{prefix:n}=i,o=null!==(r=e.key)&&void 0!==r?r:e.ref;let s=this._values[n];if(s){const t=s.get(o);if(t)return t}else s=this._values[n]=new Map;s.set(o,i);const a=this._scope[n]||(this._scope[n]=[]),h=a.length;return a[h]=e.ref,i.setValue(e,{property:n,itemIndex:h}),i}getValue(t,e){const r=this._values[t];if(r)return r.get(e)}scopeRefs(t,e=this._values){return this._reduceValues(e,(e=>{if(void 0===e.scopePath)throw new Error(`CodeGen: name "${e}" has no value`);return Jl._`${t}${e.scopePath}`}))}scopeCode(t=this._values,e,r){return this._reduceValues(t,(t=>{if(void 0===t.value)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),e,r)}_reduceValues(t,n,o={},s){let a=Jl.nil;for(const h in t){const u=t[h];if(!u)continue;const l=o[h]=o[h]||new Map;u.forEach((t=>{if(l.has(t))return;l.set(t,i.Started);let o=n(t);if(o){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;a=Jl._`${a}${r} ${t} = ${o};${this.opts._n}`}else{if(!(o=null==s?void 0:s(t)))throw new r(t);a=Jl._`${a}${o}${this.opts._n}`}l.set(t,i.Completed)}))}return a}}})),Wl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var r=Jl;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=Ql;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new Jl._Code(">"),GTE:new Jl._Code(">="),LT:new Jl._Code("<"),LTE:new Jl._Code("<="),EQ:new Jl._Code("==="),NEQ:new Jl._Code("!=="),NOT:new Jl._Code("!"),OR:new Jl._Code("||"),AND:new Jl._Code("&&"),ADD:new Jl._Code("+")};class n{optimizeNodes(){return this}optimizeNames(t,e){return this}}class o extends n{constructor(t,e,r){super(),this.varKind=t,this.name=e,this.rhs=r}render({es5:t,_n:e}){const r=t?Ql.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${i};`+e}optimizeNames(t,e){if(t[this.name.str])return this.rhs&&(this.rhs=S(this.rhs,t,e)),this}get names(){return this.rhs instanceof Jl._CodeOrName?this.rhs.names:{}}}class s extends n{constructor(t,e,r){super(),this.lhs=t,this.rhs=e,this.sideEffects=r}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,e){if(!(this.lhs instanceof Jl.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=S(this.rhs,t,e),this}get names(){return N(this.lhs instanceof Jl.Name?{}:{...this.lhs.names},this.rhs)}}class a extends s{constructor(t,e,r,i){super(t,r,i),this.op=e}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class h extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}}class u extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}}class l extends n{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class c extends n{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,e){return this.code=S(this.code,t,e),this}get names(){return this.code instanceof Jl._CodeOrName?this.code.names:{}}}class f extends n{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce(((e,r)=>e+r.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let e=t.length;for(;e--;){const r=t[e].optimizeNodes();Array.isArray(r)?t.splice(e,1,...r):r?t[e]=r:t.splice(e,1)}return t.length>0?this:void 0}optimizeNames(t,e){const{nodes:r}=this;let i=r.length;for(;i--;){const n=r[i];n.optimizeNames(t,e)||(I(t,n.names),r.splice(i,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((t,e)=>x(t,e.names)),{})}}class d extends f{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class m extends f{}class p extends d{}p.kind="else";class g extends d{constructor(t,e){super(e),this.condition=t}render(t){let e=`if(${this.condition})`+super.render(t);return this.else&&(e+="else "+this.else.render(t)),e}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(!0===t)return this.nodes;let e=this.else;if(e){const t=e.optimizeNodes();e=this.else=Array.isArray(t)?new p(t):t}return e?!1===t?e instanceof g?e:e.nodes:this.nodes.length?this:new g(R(t),e instanceof g?[e]:e.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(t,e){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(t,e),super.optimizeNames(t,e)||this.else)return this.condition=S(this.condition,t,e),this}get names(){const t=super.names;return N(t,this.condition),this.else&&x(t,this.else.names),t}}g.kind="if";class y extends d{}y.kind="for";class v extends y{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iteration=S(this.iteration,t,e),this}get names(){return x(super.names,this.iteration.names)}}class w extends y{constructor(t,e,r,i){super(),this.varKind=t,this.name=e,this.from=r,this.to=i}render(t){const e=t.es5?Ql.varKinds.var:this.varKind,{name:r,from:i,to:n}=this;return`for(${e} ${r}=${i}; ${r}<${n}; ${r}++)`+super.render(t)}get names(){const t=N(super.names,this.from);return N(t,this.to)}}class b extends y{constructor(t,e,r,i){super(),this.loop=t,this.varKind=e,this.name=r,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iterable=S(this.iterable,t,e),this}get names(){return x(super.names,this.iterable.names)}}class M extends d{constructor(t,e,r){super(),this.name=t,this.args=e,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}M.kind="func";class _ extends f{render(t){return"return "+super.render(t)}}_.kind="return";class E extends d{render(t){let e="try"+super.render(t);return this.catch&&(e+=this.catch.render(t)),this.finally&&(e+=this.finally.render(t)),e}optimizeNodes(){var t,e;return super.optimizeNodes(),null===(t=this.catch)||void 0===t||t.optimizeNodes(),null===(e=this.finally)||void 0===e||e.optimizeNodes(),this}optimizeNames(t,e){var r,i;return super.optimizeNames(t,e),null===(r=this.catch)||void 0===r||r.optimizeNames(t,e),null===(i=this.finally)||void 0===i||i.optimizeNames(t,e),this}get names(){const t=super.names;return this.catch&&x(t,this.catch.names),this.finally&&x(t,this.finally.names),t}}class A extends d{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}A.kind="catch";class k extends d{render(t){return"finally"+super.render(t)}}k.kind="finally";function x(t,e){for(const r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function N(t,e){return e instanceof Jl._CodeOrName?x(t,e.names):t}function S(t,e,r){return t instanceof Jl.Name?n(t):(i=t)instanceof Jl._Code&&i._items.some((t=>t instanceof Jl.Name&&1===e[t.str]&&void 0!==r[t.str]))?new Jl._Code(t._items.reduce(((t,e)=>(e instanceof Jl.Name&&(e=n(e)),e instanceof Jl._Code?t.push(...e._items):t.push(e),t)),[])):t;var i;function n(t){const i=r[t.str];return void 0===i||1!==e[t.str]?t:(delete e[t.str],i)}}function I(t,e){for(const r in e)t[r]=(t[r]||0)-(e[r]||0)}function R(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:Jl._`!${O(t)}`}e.CodeGen=class{constructor(t,e={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...e,_n:e.lines?"\n":""},this._extScope=t,this._scope=new Ql.Scope({parent:t}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,e){const r=this._extScope.value(t,e);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(t,e){return this._extScope.getValue(t,e)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,e,r,i){const n=this._scope.toName(e);return void 0!==r&&i&&(this._constants[n.str]=r),this._leafNode(new o(t,n,r)),n}const(t,e,r){return this._def(Ql.varKinds.const,t,e,r)}let(t,e,r){return this._def(Ql.varKinds.let,t,e,r)}var(t,e,r){return this._def(Ql.varKinds.var,t,e,r)}assign(t,e,r){return this._leafNode(new s(t,e,r))}add(t,r){return this._leafNode(new a(t,e.operators.ADD,r))}code(t){return"function"==typeof t?t():t!==Jl.nil&&this._leafNode(new c(t)),this}object(...t){const e=["{"];for(const[r,i]of t)e.length>1&&e.push(","),e.push(r),(r!==i||this.opts.es5)&&(e.push(":"),(0,Jl.addCodeArg)(e,i));return e.push("}"),new Jl._Code(e)}if(t,e,r){if(this._blockNode(new g(t)),e&&r)this.code(e).else().code(r).endIf();else if(e)this.code(e).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new g(t))}else(){return this._elseNode(new p)}endIf(){return this._endBlockNode(g,p)}_for(t,e){return this._blockNode(t),e&&this.code(e).endFor(),this}for(t,e){return this._for(new v(t),e)}forRange(t,e,r,i,n=(this.opts.es5?Ql.varKinds.var:Ql.varKinds.let)){const o=this._scope.toName(t);return this._for(new w(n,o,e,r),(()=>i(o)))}forOf(t,e,r,i=Ql.varKinds.const){const n=this._scope.toName(t);if(this.opts.es5){const t=e instanceof Jl.Name?e:this.var("_arr",e);return this.forRange("_i",0,Jl._`${t}.length`,(e=>{this.var(n,Jl._`${t}[${e}]`),r(n)}))}return this._for(new b("of",i,n,e),(()=>r(n)))}forIn(t,e,r,i=(this.opts.es5?Ql.varKinds.var:Ql.varKinds.const)){if(this.opts.ownProperties)return this.forOf(t,Jl._`Object.keys(${e})`,r);const n=this._scope.toName(t);return this._for(new b("in",i,n,e),(()=>r(n)))}endFor(){return this._endBlockNode(y)}label(t){return this._leafNode(new h(t))}break(t){return this._leafNode(new u(t))}return(t){const e=new _;if(this._blockNode(e),this.code(t),1!==e.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(t,e,r){if(!e&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new E;if(this._blockNode(i),this.code(t),e){const t=this.name("e");this._currNode=i.catch=new A(t),e(t)}return r&&(this._currNode=i.finally=new k,this.code(r)),this._endBlockNode(A,k)}throw(t){return this._leafNode(new l(t))}block(t,e){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(e),this}endBlock(t){const e=this._blockStarts.pop();if(void 0===e)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-e;if(r<0||void 0!==t&&r!==t)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${t} expected`);return this._nodes.length=e,this}func(t,e=Jl.nil,r,i){return this._blockNode(new M(t,e,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(M)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,e){const r=this._currNode;if(r instanceof t||e&&r instanceof e)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${e?`${t.kind}/${e.kind}`:t.kind}"`)}_elseNode(t){const e=this._currNode;if(!(e instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=e.else=t,this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const e=this._nodes;e[e.length-1]=t}},e.not=R;const T=P(e.operators.AND);e.and=function(...t){return t.reduce(T)};const C=P(e.operators.OR);function P(t){return(e,r)=>e===Jl.nil?r:r===Jl.nil?e:Jl._`${O(e)} ${t} ${O(r)}`}function O(t){return t instanceof Jl.Name?t:Jl._`(${t})`}e.or=function(...t){return t.reduce(C)}})),Yl=o((function(t,e){function r(t,e=t.schema){const{opts:r,self:i}=t;if(!r.strictSchema)return;if("boolean"==typeof e)return;const n=i.RULES.keywords;for(const r in e)n[r]||c(t,`unknown keyword: "${r}"`)}function i(t,e){if("boolean"==typeof t)return!t;for(const r in t)if(e[r])return!0;return!1}function n(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function o(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{const h=void 0===s?o:s instanceof Wl.Name?(o instanceof Wl.Name?t(n,o,s):e(n,o,s),s):o instanceof Wl.Name?(e(n,s,o),o):r(o,s);return a!==Wl.Name||h instanceof Wl.Name?h:i(n,h)}}function a(t,e){if(!0===e)return t.var("props",!0);const r=t.var("props",Wl._`{}`);return void 0!==e&&h(t,r,e),r}function h(t,e,r){Object.keys(r).forEach((r=>t.assign(Wl._`${e}${(0,Wl.getProperty)(r)}`,!0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0,e.toHash=function(t){const e={};for(const r of t)e[r]=!0;return e},e.alwaysValidSchema=function(t,e){return"boolean"==typeof e?e:0===Object.keys(e).length||(r(t,e),!i(e,t.self.RULES.all))},e.checkUnknownRules=r,e.schemaHasRules=i,e.schemaHasRulesButRef=function(t,e){if("boolean"==typeof t)return!t;for(const r in t)if("$ref"!==r&&e.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:t,schemaPath:e},r,i,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return Wl._`${r}`}return Wl._`${t}${e}${(0,Wl.getProperty)(i)}`},e.unescapeFragment=function(t){return o(decodeURIComponent(t))},e.escapeFragment=function(t){return encodeURIComponent(n(t))},e.escapeJsonPointer=n,e.unescapeJsonPointer=o,e.eachItem=function(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)},e.mergeEvaluated={props:s({mergeNames:(t,e,r)=>t.if(Wl._`${r} !== true && ${e} !== undefined`,(()=>{t.if(Wl._`${e} === true`,(()=>t.assign(r,!0)),(()=>t.assign(r,Wl._`${r} || {}`).code(Wl._`Object.assign(${r}, ${e})`)))})),mergeToName:(t,e,r)=>t.if(Wl._`${r} !== true`,(()=>{!0===e?t.assign(r,!0):(t.assign(r,Wl._`${r} || {}`),h(t,r,e))})),mergeValues:(t,e)=>!0===t||{...t,...e},resultToName:a}),items:s({mergeNames:(t,e,r)=>t.if(Wl._`${r} !== true && ${e} !== undefined`,(()=>t.assign(r,Wl._`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`))),mergeToName:(t,e,r)=>t.if(Wl._`${r} !== true`,(()=>t.assign(r,!0===e||Wl._`${r} > ${e} ? ${r} : ${e}`))),mergeValues:(t,e)=>!0===t||Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})},e.evaluatedPropsToName=a,e.setEvaluated=h;const u={};var l;function c(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,!0===r)throw new Error(e);t.self.logger.warn(e)}}e.useFunc=function(t,e){return t.scopeValue("func",{ref:e,code:u[e.code]||(u[e.code]=new Jl._Code(e.code))})},function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"}(l=e.Type||(e.Type={})),e.getErrorPath=function(t,e,r){if(t instanceof Wl.Name){const i=e===l.Num;return r?i?Wl._`"[" + ${t} + "]"`:Wl._`"['" + ${t} + "']"`:i?Wl._`"/" + ${t}`:Wl._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Wl.getProperty)(t).toString():"/"+n(t)},e.checkStrictMode=c}));var Xl={data:new Wl.Name("data"),valCxt:new Wl.Name("valCxt"),instancePath:new Wl.Name("instancePath"),parentData:new Wl.Name("parentData"),parentDataProperty:new Wl.Name("parentDataProperty"),rootData:new Wl.Name("rootData"),dynamicAnchors:new Wl.Name("dynamicAnchors"),vErrors:new Wl.Name("vErrors"),errors:new Wl.Name("errors"),this:new Wl.Name("this"),self:new Wl.Name("self"),scope:new Wl.Name("scope"),json:new Wl.Name("json"),jsonPos:new Wl.Name("jsonPos"),jsonLen:new Wl.Name("jsonLen"),jsonPart:new Wl.Name("jsonPart")},tc=Object.defineProperty({default:Xl},"__esModule",{value:!0}),ec=o((function(t,e){function r(t,e){const r=t.const("err",e);t.if(Wl._`${tc.default.vErrors} === null`,(()=>t.assign(tc.default.vErrors,Wl._`[${r}]`)),Wl._`${tc.default.vErrors}.push(${r})`),t.code(Wl._`${tc.default.errors}++`)}function i(t,e){const{gen:r,validateName:i,schemaEnv:n}=t;n.$async?r.throw(Wl._`new ${t.ValidationError}(${e})`):(r.assign(Wl._`${i}.errors`,e),r.return(!1))}Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0,e.keywordError={message:({keyword:t})=>Wl.str`must pass "${t}" keyword validation`},e.keyword$DataError={message:({keyword:t,schemaType:e})=>e?Wl.str`"${t}" keyword must be ${e} ($data)`:Wl.str`"${t}" keyword is invalid ($data)`},e.reportError=function(t,n=e.keywordError,s,a){const{it:h}=t,{gen:u,compositeRule:l,allErrors:c}=h,f=o(t,n,s);(null!=a?a:l||c)?r(u,f):i(h,Wl._`[${f}]`)},e.reportExtraError=function(t,n=e.keywordError,s){const{it:a}=t,{gen:h,compositeRule:u,allErrors:l}=a;r(h,o(t,n,s)),u||l||i(a,tc.default.vErrors)},e.resetErrorsCount=function(t,e){t.assign(tc.default.errors,e),t.if(Wl._`${tc.default.vErrors} !== null`,(()=>t.if(e,(()=>t.assign(Wl._`${tc.default.vErrors}.length`,e)),(()=>t.assign(tc.default.vErrors,null)))))},e.extendErrors=function({gen:t,keyword:e,schemaValue:r,data:i,errsCount:n,it:o}){if(void 0===n)throw new Error("ajv implementation error");const s=t.name("err");t.forRange("i",n,tc.default.errors,(n=>{t.const(s,Wl._`${tc.default.vErrors}[${n}]`),t.if(Wl._`${s}.instancePath === undefined`,(()=>t.assign(Wl._`${s}.instancePath`,(0,Wl.strConcat)(tc.default.instancePath,o.errorPath)))),t.assign(Wl._`${s}.schemaPath`,Wl.str`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign(Wl._`${s}.schema`,r),t.assign(Wl._`${s}.data`,i))}))};const n={keyword:new Wl.Name("keyword"),schemaPath:new Wl.Name("schemaPath"),params:new Wl.Name("params"),propertyName:new Wl.Name("propertyName"),message:new Wl.Name("message"),schema:new Wl.Name("schema"),parentSchema:new Wl.Name("parentSchema")};function o(t,e,r){const{createErrors:i}=t.it;return!1===i?Wl._`{}`:function(t,e,r={}){const{gen:i,it:o}=t,h=[s(o,r),a(t,r)];return function(t,{params:e,message:r},i){const{keyword:o,data:s,schemaValue:a,it:h}=t,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:f}=h;i.push([n.keyword,o],[n.params,"function"==typeof e?e(t):e||Wl._`{}`]),u.messages&&i.push([n.message,"function"==typeof r?r(t):r]);u.verbose&&i.push([n.schema,a],[n.parentSchema,Wl._`${c}${f}`],[tc.default.data,s]);l&&i.push([n.propertyName,l])}(t,e,h),i.object(...h)}(t,e,r)}function s({errorPath:t},{instancePath:e}){const r=e?Wl.str`${t}${(0,Yl.getErrorPath)(e,Yl.Type.Str)}`:t;return[tc.default.instancePath,(0,Wl.strConcat)(tc.default.instancePath,r)]}function a({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:i}){let o=i?e:Wl.str`${e}/${t}`;return r&&(o=Wl.str`${o}${(0,Yl.getErrorPath)(r,Yl.Type.Str)}`),[n.schemaPath,o]}})),rc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;const r={message:"boolean schema is false"};function i(t,e){const{gen:i,data:n}=t,o={gen:i,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ec.reportError)(o,r,void 0,e)}e.topBoolOrEmptySchema=function(t){const{gen:e,schema:r,validateName:n}=t;!1===r?i(t,!1):"object"==typeof r&&!0===r.$async?e.return(tc.default.data):(e.assign(Wl._`${n}.errors`,null),e.return(!0))},e.boolOrEmptySchema=function(t,e){const{gen:r,schema:n}=t;!1===n?(r.var(e,!1),i(t)):r.var(e,!0)}})),ic=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(t){return"string"==typeof t&&r.has(t)},e.getRules=function(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}})),nc=o((function(t,e){function r(t,e){return e.rules.some((e=>i(t,e)))}function i(t,e){var r;return void 0!==t[e.keyword]||(null===(r=e.definition.implements)||void 0===r?void 0:r.some((e=>void 0!==t[e])))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:t,self:e},i){const n=e.RULES.types[i];return n&&!0!==n&&r(t,n)},e.shouldUseGroup=r,e.shouldUseRule=i})),oc=o((function(t,e){var r;function i(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(ic.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0,function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"}(r=e.DataType||(e.DataType={})),e.getSchemaTypes=function(t){const e=i(t.type);if(e.includes("null")){if(!1===t.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&void 0!==t.nullable)throw new Error('"nullable" cannot be used without "type"');!0===t.nullable&&e.push("null")}return e},e.getJSONTypes=i,e.coerceAndCheckDataType=function(t,e){const{gen:i,data:o,opts:a}=t,u=function(t,e){return e?t.filter((t=>n.has(t)||"array"===e&&"array"===t)):[]}(e,a.coerceTypes),l=e.length>0&&!(0===u.length&&1===e.length&&(0,nc.schemaHasRulesForType)(t,e[0]));if(l){const l=s(e,o,a.strictNumbers,r.Wrong);i.if(l,(()=>{u.length?function(t,e,r){const{gen:i,data:o,opts:a}=t,u=i.let("dataType",Wl._`typeof ${o}`),l=i.let("coerced",Wl._`undefined`);"array"===a.coerceTypes&&i.if(Wl._`${u} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>i.assign(o,Wl._`${o}[0]`).assign(u,Wl._`typeof ${o}`).if(s(e,o,a.strictNumbers),(()=>i.assign(l,o)))));i.if(Wl._`${l} !== undefined`);for(const t of r)(n.has(t)||"array"===t&&"array"===a.coerceTypes)&&c(t);function c(t){switch(t){case"string":return void i.elseIf(Wl._`${u} == "number" || ${u} == "boolean"`).assign(l,Wl._`"" + ${o}`).elseIf(Wl._`${o} === null`).assign(l,Wl._`""`);case"number":return void i.elseIf(Wl._`${u} == "boolean" || ${o} === null
|
|
15
|
+
***************************************************************************** */function t(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function e(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})})),e}function o(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=o((function(t,e){var i="undefined"!=typeof self?self:r,n=function(){function t(){this.fetch=!1,this.DOMException=i.DOMException}return t.prototype=i,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function m(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function p(t){var e=new FileReader,r=m(e);return e.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,r,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=m(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=u(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},f.prototype.delete=function(t){delete this.map[u(t)]},f.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},f.prototype.set=function(t,e){this.map[u(t)]=l(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,i,n=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),v.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function M(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},M.error=function(){var t=new M(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];M.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new M(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(i,o){var s=new w(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;i(new M(n,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&n&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",h)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=f,t.Request=w,t.Response=M),e.Headers=f,e.Request=w,e.Response=M,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e})),a=i(s);let h=!1,u=!1;const l={debug:1,default:2,info:2,warning:3,error:4,off:5};let c=l.default,f=null;const d=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 m,p;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(m||(m={})),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"}(p||(p={}));const g="0123456789abcdef";class y{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",t),c>l[r]||console.log.apply(console,e)}debug(...t){this._log(y.levels.DEBUG,t)}info(...t){this._log(y.levels.INFO,t)}warn(...t){this._log(y.levels.WARNING,t)}makeError(t,e,r){if(u)return this.makeError("censored error",e,{});e||(e=y.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+=g[e[t]>>4],r+=g[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case p.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case p.CALL_EXCEPTION:case p.INSUFFICIENT_FUNDS:case p.MISSING_NEW:case p.NONCE_EXPIRED:case p.REPLACEMENT_UNDERPRICED:case p.TRANSACTION_REPLACED:case p.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,y.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){d&&this.throwError("platform missing String.prototype.normalize",y.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,y.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,y.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",y.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",y.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",y.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return f||(f=new y("logger/5.6.0")),f}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),h){if(!t)return;this.globalLogger().throwError("error censorship permanent",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}u=!!t,h=!!e}static setLogLevel(t){const e=l[t.toLowerCase()];null!=e?c=e:y.globalLogger().warn("invalid log level - "+t)}static from(t){return new y(t)}}y.errors=p,y.levels=m;const v=new y("bytes/5.6.1");function w(t){return!!t.toHexString}function b(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return b(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function M(t){return N(t)&&!(t.length%2)||E(t)}function _(t){return"number"==typeof t&&t==t&&t%1==0}function E(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!_(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!_(r)||r<0||r>=256)return!1}return!0}function A(t,e){if(e||(e={}),"number"==typeof t){v.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),b(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),w(t)&&(t=t.toHexString()),N(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":v.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 b(new Uint8Array(i))}return E(t)?b(new Uint8Array(t)):v.throwArgumentError("invalid arrayify value","value",t)}function k(t){const e=t.map((t=>A(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),b(i)}function x(t){let e=A(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function N(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const S="0123456789abcdef";function I(t,e){if(e||(e={}),"number"==typeof t){v.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=S[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),w(t))return t.toHexString();if(N(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":v.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(E(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=S[(240&i)>>4]+S[15&i]}return e}return v.throwArgumentError("invalid hexlify value","value",t)}function R(t){if("string"!=typeof t)t=I(t);else if(!N(t)||t.length%2)return null;return(t.length-2)/2}function T(t,e,r){return"string"!=typeof t?t=I(t):(!N(t)||t.length%2)&&v.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function C(t){let e="0x";return t.forEach((t=>{e+=I(t).substring(2)})),e}function P(t){const e=function(t){"string"!=typeof t&&(t=I(t));N(t)||v.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(I(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function O(t,e){for("string"!=typeof t?t=I(t):N(t)||v.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&v.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function B(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(M(t)){let r=A(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64))):65===r.length?(e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64)),e.v=r[64]):v.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:v.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=I(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=A(t)).length>e&&v.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),b(r)}(A(e._vs),32);e._vs=I(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&v.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=I(r);null==e.s?e.s=n:e.s!==n&&v.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?v.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&&v.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&N(e.r)?e.r=O(e.r,32):v.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&N(e.s)?e.s=O(e.s,32):v.throwArgumentError("signature missing or invalid s","signature",t);const r=A(e.s);r[0]>=128&&v.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=I(r);e._vs&&(N(e._vs)||v.throwArgumentError("signature invalid _vs","signature",t),e._vs=O(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&v.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var $="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},U=[],D=[],L="undefined"!=typeof Uint8Array?Uint8Array:Array,F=!1;function j(){F=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)U[e]=t[e],D[t.charCodeAt(e)]=e;D["-".charCodeAt(0)]=62,D["_".charCodeAt(0)]=63}function z(t,e,r){for(var i,n,o=[],s=e;s<r;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(U[(n=i)>>18&63]+U[n>>12&63]+U[n>>6&63]+U[63&n]);return o.join("")}function q(t){var e;F||j();for(var r=t.length,i=r%3,n="",o=[],s=16383,a=0,h=r-i;a<h;a+=s)o.push(z(t,a,a+s>h?h:a+s));return 1===i?(e=t[r-1],n+=U[e>>2],n+=U[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=U[e>>10],n+=U[e>>4&63],n+=U[e<<2&63],n+="="),o.push(n),o.join("")}function H(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<<a)-1,u=h>>1,l=-7,c=r?n-1:0,f=r?-1:1,d=t[e+c];for(c+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+c],c+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+t[e+c],c+=f,l-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)}function V(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,l=(1<<u)-1,c=l>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,m=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(s++,h/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*h-1)*Math.pow(2,n),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;t[r+d]=255&a,d+=m,a/=256,n-=8);for(s=s<<n|a,u+=n;u>0;t[r+d]=255&s,d+=m,s/=256,u-=8);t[r+d-m]|=128*p}var Z={}.toString,G=Array.isArray||function(t){return"[object Array]"==Z.call(t)};W.TYPED_ARRAY_SUPPORT=void 0===$.TYPED_ARRAY_SUPPORT||$.TYPED_ARRAY_SUPPORT;var K=J();function J(){return W.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Q(t,e){if(J()<e)throw new RangeError("Invalid typed array length");return W.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=W.prototype:(null===t&&(t=new W(e)),t.length=e),t}function W(t,e,r){if(!(W.TYPED_ARRAY_SUPPORT||this instanceof W))return new W(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return tt(this,t)}return Y(this,t,e,r)}function Y(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);W.TYPED_ARRAY_SUPPORT?(t=e).__proto__=W.prototype:t=et(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!W.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|nt(e,r),n=(t=Q(t,i)).write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(it(e)){var r=0|rt(e.length);return 0===(t=Q(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?Q(t,0):et(t,e);if("Buffer"===e.type&&G(e.data))return et(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function X(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function tt(t,e){if(X(e),t=Q(t,e<0?0:0|rt(e)),!W.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function et(t,e){var r=e.length<0?0:0|rt(e.length);t=Q(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function rt(t){if(t>=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return 0|t}function it(t){return!(null==t||!t._isBuffer)}function nt(t,e){if(it(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Tt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ct(t).length;default:if(i)return Tt(t).length;e=(""+e).toLowerCase(),i=!0}}function ot(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return bt(this,e,r);case"utf8":case"utf-8":return gt(this,e,r);case"ascii":return vt(this,e,r);case"latin1":case"binary":return wt(this,e,r);case"base64":return pt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function st(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function at(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=W.from(e,i)),it(e))return 0===e.length?-1:ht(t,e,r,i,n);if("number"==typeof e)return e&=255,W.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ht(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function ht(t,e,r,i,n){var o,s=1,a=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var l=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===h)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var c=!0,f=0;f<h;f++)if(u(t,o+f)!==u(e,f)){c=!1;break}if(c)return o}return-1}function ut(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function lt(t,e,r,i){return Pt(Tt(e,t.length-r),t,r,i)}function ct(t,e,r,i){return Pt(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function ft(t,e,r,i){return ct(t,e,r,i)}function dt(t,e,r,i){return Pt(Ct(e),t,r,i)}function mt(t,e,r,i){return Pt(function(t,e){for(var r,i,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(r=t.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function pt(t,e,r){return 0===e&&r===t.length?q(t):q(t.slice(e,r))}function gt(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,h,u=t[n],l=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(l=h);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(t){var e=t.length;if(e<=yt)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=yt));return r}(i)}W.poolSize=8192,W._augment=function(t){return t.__proto__=W.prototype,t},W.from=function(t,e,r){return Y(null,t,e,r)},W.TYPED_ARRAY_SUPPORT&&(W.prototype.__proto__=Uint8Array.prototype,W.__proto__=Uint8Array),W.alloc=function(t,e,r){return function(t,e,r,i){return X(e),e<=0?Q(t,e):void 0!==r?"string"==typeof i?Q(t,e).fill(r,i):Q(t,e).fill(r):Q(t,e)}(null,t,e,r)},W.allocUnsafe=function(t){return tt(null,t)},W.allocUnsafeSlow=function(t){return tt(null,t)},W.isBuffer=Ot,W.compare=function(t,e){if(!it(t)||!it(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},W.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},W.concat=function(t,e){if(!G(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return W.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=W.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!it(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},W.byteLength=nt,W.prototype._isBuffer=!0,W.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)st(this,e,e+1);return this},W.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)st(this,e,e+3),st(this,e+1,e+2);return this},W.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)st(this,e,e+7),st(this,e+1,e+6),st(this,e+2,e+5),st(this,e+3,e+4);return this},W.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?gt(this,0,t):ot.apply(this,arguments)},W.prototype.equals=function(t){if(!it(t))throw new TypeError("Argument must be a Buffer");return this===t||0===W.compare(this,t)},W.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},W.prototype.compare=function(t,e,r,i,n){if(!it(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(i,n),u=t.slice(e,r),l=0;l<a;++l)if(h[l]!==u[l]){o=h[l],s=u[l];break}return o<s?-1:s<o?1:0},W.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},W.prototype.indexOf=function(t,e,r){return at(this,t,e,r,!0)},W.prototype.lastIndexOf=function(t,e,r){return at(this,t,e,r,!1)},W.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return ut(this,t,e,r);case"utf8":case"utf-8":return lt(this,t,e,r);case"ascii":return ct(this,t,e,r);case"latin1":case"binary":return ft(this,t,e,r);case"base64":return dt(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},W.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var yt=4096;function vt(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function wt(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function bt(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=Rt(t[o]);return n}function Mt(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function _t(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function Et(t,e,r,i,n,o){if(!it(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function At(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n<o;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function kt(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n<o;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function xt(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Nt(t,e,r,i,n){return n||xt(t,0,r,4),V(t,e,r,i,23,4),r+4}function St(t,e,r,i,n){return n||xt(t,0,r,8),V(t,e,r,i,52,8),r+8}W.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),W.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=W.prototype;else{var n=e-t;r=new W(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+t]}return r},W.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},W.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},W.prototype.readUInt8=function(t,e){return e||_t(t,1,this.length),this[t]},W.prototype.readUInt16LE=function(t,e){return e||_t(t,2,this.length),this[t]|this[t+1]<<8},W.prototype.readUInt16BE=function(t,e){return e||_t(t,2,this.length),this[t]<<8|this[t+1]},W.prototype.readUInt32LE=function(t,e){return e||_t(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},W.prototype.readUInt32BE=function(t,e){return e||_t(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},W.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},W.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||_t(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},W.prototype.readInt8=function(t,e){return e||_t(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},W.prototype.readInt16LE=function(t,e){e||_t(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},W.prototype.readInt16BE=function(t,e){e||_t(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},W.prototype.readInt32LE=function(t,e){return e||_t(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},W.prototype.readInt32BE=function(t,e){return e||_t(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},W.prototype.readFloatLE=function(t,e){return e||_t(t,4,this.length),H(this,t,!0,23,4)},W.prototype.readFloatBE=function(t,e){return e||_t(t,4,this.length),H(this,t,!1,23,4)},W.prototype.readDoubleLE=function(t,e){return e||_t(t,8,this.length),H(this,t,!0,52,8)},W.prototype.readDoubleBE=function(t,e){return e||_t(t,8,this.length),H(this,t,!1,52,8)},W.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Et(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},W.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||Et(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},W.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,1,255,0),W.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},W.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,65535,0),W.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):At(this,t,e,!0),e+2},W.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,65535,0),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):At(this,t,e,!1),e+2},W.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,4294967295,0),W.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):kt(this,t,e,!0),e+4},W.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,4294967295,0),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):kt(this,t,e,!1),e+4},W.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Et(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},W.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);Et(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},W.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,1,127,-128),W.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},W.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,32767,-32768),W.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):At(this,t,e,!0),e+2},W.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,2,32767,-32768),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):At(this,t,e,!1),e+2},W.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,2147483647,-2147483648),W.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):kt(this,t,e,!0),e+4},W.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||Et(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),W.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):kt(this,t,e,!1),e+4},W.prototype.writeFloatLE=function(t,e,r){return Nt(this,t,e,!0,r)},W.prototype.writeFloatBE=function(t,e,r){return Nt(this,t,e,!1,r)},W.prototype.writeDoubleLE=function(t,e,r){return St(this,t,e,!0,r)},W.prototype.writeDoubleBE=function(t,e,r){return St(this,t,e,!1,r)},W.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n,o=i-r;if(this===t&&r<e&&e<i)for(n=o-1;n>=0;--n)t[n+e]=this[n+r];else if(o<1e3||!W.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},W.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!W.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=it(t)?t:Tt(new W(t,i).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var It=/[^+\/0-9A-Za-z-_]/g;function Rt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Tt(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Ct(t){return function(t){var e,r,i,n,o,s;F||j();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new L(3*a/4-o),i=o>0?a-4:a;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)n=D[t.charCodeAt(e)]<<18|D[t.charCodeAt(e+1)]<<12|D[t.charCodeAt(e+2)]<<6|D[t.charCodeAt(e+3)],s[h++]=n>>16&255,s[h++]=n>>8&255,s[h++]=255&n;return 2===o?(n=D[t.charCodeAt(e)]<<2|D[t.charCodeAt(e+1)]>>4,s[h++]=255&n):1===o&&(n=D[t.charCodeAt(e)]<<10|D[t.charCodeAt(e+1)]<<4|D[t.charCodeAt(e+2)]>>2,s[h++]=n>>8&255,s[h++]=255&n),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(It,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Pt(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Ot(t){return null!=t&&(!!t._isBuffer||Bt(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Bt(t.slice(0,0))}(t))}function Bt(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var $t=n(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:K,Buffer:W,SlowBuffer:function(t){return+t!=t&&(t=0),W.alloc(+t)},isBuffer:Ot})),Ut=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Dt=Ut.BN;const Lt=new y("bignumber/5.6.2"),Ft={},jt=9007199254740991;let zt=!1;class qt{constructor(t,e){t!==Ft&&Lt.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Vt(Zt(this).fromTwos(t))}toTwos(t){return Vt(Zt(this).toTwos(t))}abs(){return"-"===this._hex[0]?qt.from(this._hex.substring(1)):this}add(t){return Vt(Zt(this).add(Zt(t)))}sub(t){return Vt(Zt(this).sub(Zt(t)))}div(t){return qt.from(t).isZero()&&Gt("division-by-zero","div"),Vt(Zt(this).div(Zt(t)))}mul(t){return Vt(Zt(this).mul(Zt(t)))}mod(t){const e=Zt(t);return e.isNeg()&&Gt("division-by-zero","mod"),Vt(Zt(this).umod(e))}pow(t){const e=Zt(t);return e.isNeg()&&Gt("negative-power","pow"),Vt(Zt(this).pow(e))}and(t){const e=Zt(t);return(this.isNegative()||e.isNeg())&&Gt("unbound-bitwise-result","and"),Vt(Zt(this).and(e))}or(t){const e=Zt(t);return(this.isNegative()||e.isNeg())&&Gt("unbound-bitwise-result","or"),Vt(Zt(this).or(e))}xor(t){const e=Zt(t);return(this.isNegative()||e.isNeg())&&Gt("unbound-bitwise-result","xor"),Vt(Zt(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Gt("negative-width","mask"),Vt(Zt(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Gt("negative-width","shl"),Vt(Zt(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Gt("negative-width","shr"),Vt(Zt(this).shrn(t))}eq(t){return Zt(this).eq(Zt(t))}lt(t){return Zt(this).lt(Zt(t))}lte(t){return Zt(this).lte(Zt(t))}gt(t){return Zt(this).gt(Zt(t))}gte(t){return Zt(this).gte(Zt(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Zt(this).isZero()}toNumber(){try{return Zt(this).toNumber()}catch(t){Gt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Lt.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zt||(zt=!0,Lt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Lt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Lt.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Zt(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof qt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new qt(Ft,Ht(t)):t.match(/^-?[0-9]+$/)?new qt(Ft,Ht(new Dt(t))):Lt.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Gt("underflow","BigNumber.from",t),(t>=jt||t<=-jt)&&Gt("overflow","BigNumber.from",t),qt.from(String(t));const e=t;if("bigint"==typeof e)return qt.from(e.toString());if(E(e))return qt.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return qt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return qt.from(t)}return Lt.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Ht(t){if("string"!=typeof t)return Ht(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Lt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ht(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 Vt(t){return qt.from(Ht(t))}function Zt(t){const e=qt.from(t).toHexString();return"-"===e[0]?new Dt("-"+e.substring(3),16):new Dt(e.substring(2),16)}function Gt(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Lt.throwError(t,y.errors.NUMERIC_FAULT,i)}function Kt(){throw new Error("setTimeout has not been defined")}function Jt(){throw new Error("clearTimeout has not been defined")}var Qt=Kt,Wt=Jt;function Yt(t){if(Qt===setTimeout)return setTimeout(t,0);if((Qt===Kt||!Qt)&&setTimeout)return Qt=setTimeout,setTimeout(t,0);try{return Qt(t,0)}catch(e){try{return Qt.call(null,t,0)}catch(e){return Qt.call(this,t,0)}}}"function"==typeof $.setTimeout&&(Qt=setTimeout),"function"==typeof $.clearTimeout&&(Wt=clearTimeout);var Xt,te=[],ee=!1,re=-1;function ie(){ee&&Xt&&(ee=!1,Xt.length?te=Xt.concat(te):re=-1,te.length&&ne())}function ne(){if(!ee){var t=Yt(ie);ee=!0;for(var e=te.length;e;){for(Xt=te,te=[];++re<e;)Xt&&Xt[re].run();re=-1,e=te.length}Xt=null,ee=!1,function(t){if(Wt===clearTimeout)return clearTimeout(t);if((Wt===Jt||!Wt)&&clearTimeout)return Wt=clearTimeout,clearTimeout(t);try{Wt(t)}catch(e){try{return Wt.call(null,t)}catch(e){return Wt.call(this,t)}}}(t)}}function oe(t,e){this.fun=t,this.array=e}oe.prototype.run=function(){this.fun.apply(null,this.array)};function se(){}var ae=se,he=se,ue=se,le=se,ce=se,fe=se,de=se;var me=$.performance||{},pe=me.now||me.mozNow||me.msNow||me.oNow||me.webkitNow||function(){return(new Date).getTime()};var ge=new Date;var ye={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];te.push(new oe(t,e)),1!==te.length||ee||Yt(ne)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ae,addListener:he,once:ue,off:le,removeListener:ce,removeAllListeners:fe,emit:de,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*pe.call(me),r=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(r-=t[0],(i-=t[1])<0&&(r--,i+=1e9)),[r,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ge)/1e3}},ve=o((function(t){!function(){var e="input is invalid type",i="object"==typeof window,n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var o=!i&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof ye&&ye.versions&&ye.versions.node?n=r:o&&(n=self);var s=!n.JS_SHA3_NO_COMMON_JS&&t.exports,a=!n.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),u=[4,1024,262144,67108864],l=[0,8,16,24],c=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],f=[224,256,384,512],d=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!n.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var g=function(t,e,r){return function(i){return new T(t,e,t).update(i)[r]()}},y=function(t,e,r){return function(i,n){return new T(t,e,n).update(i)[r]()}},v=function(t,e,r){return function(e,i,n,o){return E["cshake"+t].update(e,i,n,o)[r]()}},w=function(t,e,r){return function(e,i,n,o){return E["kmac"+t].update(e,i,n,o)[r]()}},b=function(t,e,r,i){for(var n=0;n<m.length;++n){var o=m[n];t[o]=e(r,i,o)}return t},M=function(t,e){var r=g(t,e,"hex");return r.create=function(){return new T(t,e,t)},r.update=function(t){return r.create().update(t)},b(r,g,t,e)},_=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:M},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:M},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var r=y(t,e,"hex");return r.create=function(r){return new T(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},b(r,y,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var r=p[t],i=v(t,0,"hex");return i.create=function(i,n,o){return n||o?new T(t,e,i).bytepad([n,o],r):E["shake"+t].create(i)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},b(i,v,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var r=p[t],i=w(t,0,"hex");return i.create=function(i,n,o){return new C(t,e,n).bytepad(["KMAC",o],r).bytepad([i],r)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},b(i,w,t,e)}}],E={},A=[],k=0;k<_.length;++k)for(var x=_[k],N=x.bits,S=0;S<N.length;++S){var I=x.name+"_"+N[S];if(A.push(I),E[I]=x.createMethod(N[S],x.padding),"sha3"!==x.name){var R=x.name+N[S];A.push(R),E[R]=E[I]}}function T(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var i=0;i<50;++i)this.s[i]=0}function C(t,e,r){T.call(this,t,e,r)}T.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var n,o,s=this.blocks,h=this.byteCount,u=t.length,c=this.blockCount,f=0,d=this.s;f<u;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<c+1;++n)s[n]=0;if(r)for(n=this.start;f<u&&n<h;++f)s[n>>2]|=t[f]<<l[3&n++];else for(n=this.start;f<u&&n<h;++f)(o=t.charCodeAt(f))<128?s[n>>2]|=o<<l[3&n++]:o<2048?(s[n>>2]|=(192|o>>6)<<l[3&n++],s[n>>2]|=(128|63&o)<<l[3&n++]):o<55296||o>=57344?(s[n>>2]|=(224|o>>12)<<l[3&n++],s[n>>2]|=(128|o>>6&63)<<l[3&n++],s[n>>2]|=(128|63&o)<<l[3&n++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++f)),s[n>>2]|=(240|o>>18)<<l[3&n++],s[n>>2]|=(128|o>>12&63)<<l[3&n++],s[n>>2]|=(128|o>>6&63)<<l[3&n++],s[n>>2]|=(128|63&o)<<l[3&n++]);if(this.lastByteIndex=n,n>=h){for(this.start=n-h,this.block=s[c],n=0;n<c;++n)d[n]^=s[n];P(d),this.reset=!0}else this.start=n}return this},T.prototype.encode=function(t,e){var r=255&t,i=1,n=[r];for(r=255&(t>>=8);r>0;)n.unshift(r),r=255&(t>>=8),++i;return e?n.push(i):n.unshift(i),this.update(n),n.length},T.prototype.encodeString=function(t){var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var n=0,o=t.length;if(r)n=o;else for(var s=0;s<t.length;++s){var h=t.charCodeAt(s);h<128?n+=1:h<2048?n+=2:h<55296||h>=57344?n+=3:(h=65536+((1023&h)<<10|1023&t.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(t),n},T.prototype.bytepad=function(t,e){for(var r=this.encode(e),i=0;i<t.length;++i)r+=this.encodeString(t[i]);var n=e-r%e,o=[];return o.length=n,this.update(o),this},T.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,i=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)i[e]^=t[e];P(i)}},T.prototype.toString=T.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,o=0,s=0,a="";s<i;){for(o=0;o<e&&s<i;++o,++s)t=r[o],a+=h[t>>4&15]+h[15&t]+h[t>>12&15]+h[t>>8&15]+h[t>>20&15]+h[t>>16&15]+h[t>>28&15]+h[t>>24&15];s%e==0&&(P(r),o=0)}return n&&(t=r[o],a+=h[t>>4&15]+h[15&t],n>1&&(a+=h[t>>12&15]+h[t>>8&15]),n>2&&(a+=h[t>>20&15]+h[t>>16&15])),a},T.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=n?new ArrayBuffer(i+1<<2):new ArrayBuffer(a);for(var h=new Uint32Array(t);s<i;){for(o=0;o<e&&s<i;++o,++s)h[s]=r[o];s%e==0&&P(r)}return n&&(h[o]=r[o],t=t.slice(0,a)),t},T.prototype.buffer=T.prototype.arrayBuffer,T.prototype.digest=T.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,i=this.s,n=this.outputBlocks,o=this.extraBytes,s=0,a=0,h=[];a<n;){for(s=0;s<r&&a<n;++s,++a)t=a<<2,e=i[s],h[t]=255&e,h[t+1]=e>>8&255,h[t+2]=e>>16&255,h[t+3]=e>>24&255;a%r==0&&P(i)}return o&&(t=a<<2,e=i[s],h[t]=255&e,o>1&&(h[t+1]=e>>8&255),o>2&&(h[t+2]=e>>16&255)),h},C.prototype=new T,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var P=function(t){var e,r,i,n,o,s,a,h,u,l,f,d,m,p,g,y,v,w,b,M,_,E,A,k,x,N,S,I,R,T,C,P,O,B,$,U,D,L,F,j,z,q,H,V,Z,G,K,J,Q,W,Y,X,tt,et,rt,it,nt,ot,st,at,ht,ut,lt;for(i=0;i<48;i+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],h=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(m=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=n^(h<<1|u>>>31),r=o^(u<<1|h>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=h^(d<<1|m>>>31),r=u^(m<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=l^(n<<1|o>>>31),r=f^(o<<1|n>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,p=t[0],g=t[1],G=t[11]<<4|t[10]>>>28,K=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,R=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ht=t[30]<<9|t[31]>>>23,q=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,B=t[2]<<1|t[3]>>>31,$=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,T=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ut=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,U=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,W=t[34]<<15|t[35]>>>17,Y=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,k=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,it=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,L=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,X=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,Z=t[9]<<27|t[8]>>>5,N=t[18]<<20|t[19]>>>12,S=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,j=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~y&w,t[1]=g^~v&b,t[10]=k^~N&I,t[11]=x^~S&R,t[20]=B^~U&L,t[21]=$^~D&F,t[30]=V^~G&J,t[31]=Z^~K&Q,t[40]=et^~it&ot,t[41]=rt^~nt&st,t[2]=y^~w&M,t[3]=v^~b&_,t[12]=N^~I&T,t[13]=S^~R&C,t[22]=U^~L&j,t[23]=D^~F&z,t[32]=G^~J&W,t[33]=K^~Q&Y,t[42]=it^~ot&at,t[43]=nt^~st&ht,t[4]=w^~M&E,t[5]=b^~_&A,t[14]=I^~T&P,t[15]=R^~C&O,t[24]=L^~j&q,t[25]=F^~z&H,t[34]=J^~W&X,t[35]=Q^~Y&tt,t[44]=ot^~at&ut,t[45]=st^~ht<,t[6]=M^~E&p,t[7]=_^~A&g,t[16]=T^~P&k,t[17]=C^~O&x,t[26]=j^~q&B,t[27]=z^~H&$,t[36]=W^~X&V,t[37]=Y^~tt&Z,t[46]=at^~ut&et,t[47]=ht^~lt&rt,t[8]=E^~p&y,t[9]=A^~g&v,t[18]=P^~k&N,t[19]=O^~x&S,t[28]=q^~B&U,t[29]=H^~$&D,t[38]=X^~V&G,t[39]=tt^~Z&K,t[48]=ut^~et&it,t[49]=lt^~rt&nt,t[0]^=c[i],t[1]^=c[i+1]};if(s)t.exports=E;else for(k=0;k<A.length;++k)n[A[k]]=E[A[k]]}()}));function we(t){return"0x"+ve.keccak_256(A(t))}const be=new y("rlp/5.6.1");function Me(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function _e(t,e,r){let i=0;for(let n=0;n<r;n++)i=256*i+t[e+n];return i}function Ee(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(Ee(t))})),e.length<=55)return e.unshift(192+e.length),e;const r=Me(e.length);return r.unshift(247+r.length),r.concat(e)}M(t)||be.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(A(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=Me(e.length);return r.unshift(183+r.length),r.concat(e)}function Ae(t){return I(Ee(t))}function ke(t,e,r,i){const n=[];for(;r<e+1+i;){const o=xe(t,r);n.push(o.result),(r+=o.consumed)>e+1+i&&be.throwError("child data too short",y.errors.BUFFER_OVERRUN,{})}return{consumed:1+i,result:n}}function xe(t,e){if(0===t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&be.throwError("data short segment too short",y.errors.BUFFER_OVERRUN,{});const i=_e(t,e+1,r);return e+1+r+i>t.length&&be.throwError("data long segment too short",y.errors.BUFFER_OVERRUN,{}),ke(t,e,e+1+r,r+i)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{}),ke(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});const i=_e(t,e+1,r);e+1+r+i>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r+i,result:I(t.slice(e+1+r,e+1+r+i))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:I(t.slice(e+1,e+1+r))}}return{consumed:1,result:I(t[e])}}function Ne(t){const e=A(t),r=xe(e,0);return r.consumed!==e.length&&be.throwArgumentError("invalid rlp data","data",t),r.result}const Se=new y("address/5.6.1");function Ie(t){N(t,20)||Se.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=A(we(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Re={};for(let t=0;t<10;t++)Re[String(t)]=String(t);for(let t=0;t<26;t++)Re[String.fromCharCode(65+t)]=String(10+t);const Te=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Ce(t){let e=null;if("string"!=typeof t&&Se.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Ie(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Se.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)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Re[t])).join("");for(;e.length>=Te;){let t=e.substring(0,Te);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}(t)&&Se.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Dt(r,36).toString(16);e.length<40;)e="0"+e;e=Ie("0x"+e)}else Se.throwArgumentError("invalid address","address",t);var r;return e}function Pe(t){try{return Ce(t),!0}catch(t){}return!1}function Oe(t){let e=null;try{e=Ce(t.from)}catch(e){Se.throwArgumentError("missing from address","transaction",t)}return Ce(T(we(Ae([e,x(A(qt.from(t.nonce).toHexString()))])),12))}const Be={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},$e={Proposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"app",type:"string"}]},Ue={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"plugins",type:"string"}]},De={FlagProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},Le={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},Fe={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},je={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},ze={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},qe={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},He={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},Ve={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},Ze={Vote:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},Ge={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Ke={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Je={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Qe={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},We={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},Ye={Statement:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"space",type:"string"},{name:"about",type:"string"},{name:"statement",type:"string"},{name:"discourse",type:"string"},{name:"status",type:"string"},{name:"network",type:"string"}]},Xe={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},tr={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var er={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},rr={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},ir={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const nr={name:"snapshot",version:"0.1.4"};class or{constructor(t=er.sequencer,e={}){t=(t=(t=t.replace(er.hub,er.sequencer)).replace(rr.hub,rr.sequencer)).replace(ir.hub,ir.sequencer),this.address=t,this.options=e}sign(t,r,i,n){return e(this,void 0,void 0,(function*(){var e;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,s=Ce(r);i.from=i.from?Ce(i.from):s,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const a=Object.assign({},nr);"undefined"!=typeof window&&(null===(e=window.ethereum)||void 0===e?void 0:e.isTrust)&&(a.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:a,types:n,message:i},u=yield o._signTypedData(a,h.types,i);return yield this.send({address:s,sig:u,data:h})}))}send(t){return e(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,i)=>{a(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(i).catch(i);throw e})).catch(i)}))}))}space(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Be)}))}proposal(t,r,i){return e(this,void 0,void 0,(function*(){return i.discussion||(i.discussion=""),i.app||(i.app=""),yield this.sign(t,r,i,$e)}))}updateProposal(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ue)}))}flagProposal(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,De)}))}cancelProposal(t,r,i){return e(this,void 0,void 0,(function*(){const e=i.proposal.startsWith("0x");return yield this.sign(t,r,i,e?Fe:Le)}))}vote(t,r,i){return e(this,void 0,void 0,(function*(){const e="shutter"===(null==i?void 0:i.privacy);i.reason||(i.reason=""),i.app||(i.app=""),i.metadata||(i.metadata="{}");const n=i.proposal.startsWith("0x");let o=n?He:je;return["approval","ranked-choice"].includes(i.type)&&(o=n?Ve:ze),!e&&["quadratic","weighted"].includes(i.type)&&(o=n?Ze:qe,i.choice=JSON.stringify(i.choice)),e&&(o=n?Ze:qe),delete i.privacy,delete i.type,yield this.sign(t,r,i,o)}))}follow(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ge)}))}unfollow(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ke)}))}subscribe(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Je)}))}unsubscribe(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Qe)}))}profile(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,We)}))}statement(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Ye)}))}alias(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,Xe)}))}deleteSpace(t,r,i){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,i,tr)}))}}var sr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:4e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxLengthWithSpaceType:{default:500,turbo:1e3}},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:128}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},ar={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:2e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxLengthWithSpaceType:{default:500,turbo:1e3}},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},hr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:1e3},app:{type:"string",title:"app",maxLength:128}},required:["proposal","choice"],additionalProperties:!1}}},ur={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},lr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},cr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},fr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}},dr={space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1,maxLength:32},symbol:{type:"string",title:"symbol",minLength:1,maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64,format:"domain"},strategies:{type:"array",minItems:1,maxItemsWithSpaceType:{default:8,turbo:10},uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",maxLength:12,title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",format:"evmAddress"},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",format:"evmAddress"},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",format:"evmAddress"},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"}]},delegationContract:{type:"string",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],anyOf:[{format:"evmAddress"},{format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},delegationNetwork:{type:"string",title:"Delegation network",description:"The network of your delegation contract",anyOf:[{snapshotNetwork:!0},{starknetNetwork:!0}],errorMessage:"Must be a valid network"},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:15552e3,errorMessage:{maximum:"Delay must be less than 180 days"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector"]}},treasuries:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],anyOf:[{format:"evmAddress"},{format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},network:{type:"string",title:"Network",anyOf:[{snapshotNetwork:!0},{starknetNetwork:!0}],errorMessage:"Must be a valid network"}},required:["name","address","network"],additionalProperties:!1}},labels:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{id:{type:"string",title:"Id",minLength:1,maxLength:8},name:{type:"string",title:"Name",minLength:1,maxLength:32},description:{type:"string",title:"Description",maxLength:100},color:{type:"string",title:"Color",format:"color"}},required:["id","name","color"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1}},required:["name","network","symbol","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:sr.definitions.Proposal,updateProposal:ar.definitions.UpdateProposal,vote:hr.definitions.Vote,profile:ur.definitions.Profile,statement:lr.definitions.Statement,zodiac:cr.definitions.Zodiac,alias:fr.definitions.Alias},mr=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var pr=mr.BN;const gr=new y("bignumber/5.6.2"),yr={},vr=9007199254740991;let wr=!1;class br{constructor(t,e){t!==yr&&gr.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return _r(Er(this).fromTwos(t))}toTwos(t){return _r(Er(this).toTwos(t))}abs(){return"-"===this._hex[0]?br.from(this._hex.substring(1)):this}add(t){return _r(Er(this).add(Er(t)))}sub(t){return _r(Er(this).sub(Er(t)))}div(t){return br.from(t).isZero()&&Ar("division-by-zero","div"),_r(Er(this).div(Er(t)))}mul(t){return _r(Er(this).mul(Er(t)))}mod(t){const e=Er(t);return e.isNeg()&&Ar("division-by-zero","mod"),_r(Er(this).umod(e))}pow(t){const e=Er(t);return e.isNeg()&&Ar("negative-power","pow"),_r(Er(this).pow(e))}and(t){const e=Er(t);return(this.isNegative()||e.isNeg())&&Ar("unbound-bitwise-result","and"),_r(Er(this).and(e))}or(t){const e=Er(t);return(this.isNegative()||e.isNeg())&&Ar("unbound-bitwise-result","or"),_r(Er(this).or(e))}xor(t){const e=Er(t);return(this.isNegative()||e.isNeg())&&Ar("unbound-bitwise-result","xor"),_r(Er(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ar("negative-width","mask"),_r(Er(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ar("negative-width","shl"),_r(Er(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ar("negative-width","shr"),_r(Er(this).shrn(t))}eq(t){return Er(this).eq(Er(t))}lt(t){return Er(this).lt(Er(t))}lte(t){return Er(this).lte(Er(t))}gt(t){return Er(this).gt(Er(t))}gte(t){return Er(this).gte(Er(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Er(this).isZero()}toNumber(){try{return Er(this).toNumber()}catch(t){Ar("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return gr.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?wr||(wr=!0,gr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?gr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):gr.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Er(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof br)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new br(yr,Mr(t)):t.match(/^-?[0-9]+$/)?new br(yr,Mr(new pr(t))):gr.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ar("underflow","BigNumber.from",t),(t>=vr||t<=-vr)&&Ar("overflow","BigNumber.from",t),br.from(String(t));const e=t;if("bigint"==typeof e)return br.from(e.toString());if(E(e))return br.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return br.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return br.from(t)}return gr.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Mr(t){if("string"!=typeof t)return Mr(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&gr.throwArgumentError("invalid hex","value",t),"0x00"===(t=Mr(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 _r(t){return br.from(Mr(t))}function Er(t){const e=br.from(t).toHexString();return"-"===e[0]?new pr("-"+e.substring(3),16):new pr(e.substring(2),16)}function Ar(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),gr.throwError(t,y.errors.NUMERIC_FAULT,i)}var kr=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const xr=new y("properties/5.6.0");function Nr(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Sr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Ir(t){return kr(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function Rr(t){const e={};for(const r in t)e[r]=t[r];return e}const Tr={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Cr(t){if(null==t||Tr[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch(t){continue}if(!Cr(i))return!1}return!0}return xr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Pr(t){if(Cr(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Or(t))));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&Nr(e,r,Or(i))}return e}return xr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Or(t){return Pr(t)}class Br{constructor(t){for(const e in t)this[e]=Or(t[e])}}const $r="abi/5.6.4",Ur=new y($r),Dr={};let Lr={calldata:!0,memory:!0,storage:!0},Fr={calldata:!0,memory:!0};function jr(t,e){if("bytes"===t||"string"===t){if(Lr[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Fr[e])return!0;return(Lr[e]||"payable"===e)&&Ur.throwArgumentError("invalid modifier","name",e),!1}function zr(t,e){for(let r in e)Nr(t,r,e[r])}const qr=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Hr=new RegExp(/^(.*)\[([0-9]*)\]$/);class Vr{constructor(t,e){t!==Dr&&Ur.throwError("use fromString",y.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),zr(this,e);let r=this.type.match(Hr);zr(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Vr.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==qr.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===qr.full?", ":",")+")"):e+=this.type,t!==qr.sighash&&(!0===this.indexed&&(e+=" indexed"),t===qr.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Vr.fromString(t,e):Vr.fromObject(t)}static fromObject(t){return Vr.isParamType(t)?t:new Vr(Dr,{name:t.name||null,type:ri(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Vr.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function i(e){Ur.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function n(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||i(r),s.state.allowType=!1,s.type=ri(s.type),s.components=[n(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(e||i(r),s.indexed=!0,s.name=""),jr(s.type,s.name)&&(s.name=""),s.type=ri(s.type);let t=s;s=s.parent,s||i(r),delete t.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(e||i(r),s.indexed=!0,s.name=""),jr(s.type,s.name)&&(s.name=""),s.type=ri(s.type);let a=n(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=ri(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(e||i(r),s.indexed&&i(r),s.indexed=!0,s.name=""):jr(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||i(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||i(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:i(r)}}return s.parent&&Ur.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===s.name?(e||i(r.length-7),s.indexed&&i(r.length-7),s.indexed=!0,s.name=""):jr(s.type,s.name)&&(s.name=""),o.type=ri(o.type),o}(t,!!e),Vr.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function Zr(t,e){return function(t){t=t.trim();let e=[],r="",i=0;for(let n=0;n<t.length;n++){let o=t[n];","===o&&0===i?(e.push(r),r=""):(r+=o,"("===o?i++:")"===o&&(i--,-1===i&&Ur.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Vr.fromString(t,e)))}class Gr{constructor(t,e){t!==Dr&&Ur.throwError("use a static from method",y.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),zr(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Gr.isFragment(t)?t:"string"==typeof t?Gr.fromString(t):Gr.fromObject(t)}static fromObject(t){if(Gr.isFragment(t))return t;switch(t.type){case"function":return Xr.fromObject(t);case"event":return Kr.fromObject(t);case"constructor":return Yr.fromObject(t);case"error":return ei.fromObject(t);case"fallback":case"receive":return null}return Ur.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Kr.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Xr.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Yr.fromString(t.trim()):"error"===t.split(" ")[0]?ei.fromString(t.substring(5).trim()):Ur.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Kr extends Gr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qr.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ",t!==qr.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Kr.fromString(t):Kr.fromObject(t)}static fromObject(t){if(Kr.isEventFragment(t))return t;"event"!==t.type&&Ur.throwArgumentError("invalid event object","value",t);const e={name:ni(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Vr.fromObject):[],type:"event"};return new Kr(Dr,e)}static fromString(t){let e=t.match(oi);e||Ur.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:Ur.warn("unknown modifier: "+t)}})),Kr.fromObject({name:e[1].trim(),anonymous:r,inputs:Zr(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Jr(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&Ur.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ur.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=br.from(r[1]),r[0]):t}function Qr(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function Wr(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Ur.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Ur.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Ur.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ur.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Ur.throwArgumentError("unable to determine stateMutability","value",t),e}class Yr extends Gr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===qr.sighash&&Ur.throwError("cannot format a constructor for sighash",y.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Yr.fromString(t):Yr.fromObject(t)}static fromObject(t){if(Yr.isConstructorFragment(t))return t;"constructor"!==t.type&&Ur.throwArgumentError("invalid constructor object","value",t);let e=Wr(t);e.constant&&Ur.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Vr.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?br.from(t.gas):null};return new Yr(Dr,r)}static fromString(t){let e={type:"constructor"},r=(t=Jr(t,e)).match(oi);return r&&"constructor"===r[1].trim()||Ur.throwArgumentError("invalid constructor string","value",t),e.inputs=Zr(r[2].trim(),!1),Qr(r[3].trim(),e),Yr.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Xr extends Yr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qr.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ",t!==qr.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Xr.fromString(t):Xr.fromObject(t)}static fromObject(t){if(Xr.isFunctionFragment(t))return t;"function"!==t.type&&Ur.throwArgumentError("invalid function object","value",t);let e=Wr(t);const r={type:t.type,name:ni(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Vr.fromObject):[],outputs:t.outputs?t.outputs.map(Vr.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?br.from(t.gas):null};return new Xr(Dr,r)}static fromString(t){let e={type:"function"},r=(t=Jr(t,e)).split(" returns ");r.length>2&&Ur.throwArgumentError("invalid function string","value",t);let i=r[0].match(oi);if(i||Ur.throwArgumentError("invalid function signature","value",t),e.name=i[1].trim(),e.name&&ni(e.name),e.inputs=Zr(i[2],!1),Qr(i[3].trim(),e),r.length>1){let i=r[1].match(oi);""==i[1].trim()&&""==i[3].trim()||Ur.throwArgumentError("unexpected tokens","value",t),e.outputs=Zr(i[2],!1)}else e.outputs=[];return Xr.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function ti(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Ur.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Gr{format(t){if(t||(t=qr.sighash),qr[t]||Ur.throwArgumentError("invalid format type","format",t),t===qr.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==qr.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===qr.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?ei.fromString(t):ei.fromObject(t)}static fromObject(t){if(ei.isErrorFragment(t))return t;"error"!==t.type&&Ur.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:ni(t.name),inputs:t.inputs?t.inputs.map(Vr.fromObject):[]};return ti(new ei(Dr,e))}static fromString(t){let e={type:"error"},r=t.match(oi);return r||Ur.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&ni(e.name),e.inputs=Zr(r[2],!1),ti(ei.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function ri(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const ii=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ni(t){return t&&t.match(ii)||Ur.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const oi=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const si=new y($r);class ai{constructor(t,e,r,i){this.name=t,this.type=e,this.localName=r,this.dynamic=i}_throwError(t,e){si.throwArgumentError(t,this.localName,e)}}class hi{constructor(t){Nr(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return C(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(k(t._data))}writeBytes(t){let e=A(t);const r=e.length%this.wordSize;return r&&(e=k([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=A(br.from(t));return e.length>this.wordSize&&si.throwError("value out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=k([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class ui{constructor(t,e,r,i){Nr(this,"_data",A(t)),Nr(this,"wordSize",e||32),Nr(this,"_coerceFunc",r),Nr(this,"allowLoose",i),this._offset=0}get data(){return I(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):ui.coerce(t,e)}_peekBytes(t,e,r){let i=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?i=e:si.throwError("data out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(t){return new ui(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return br.from(this.readBytes(this.wordSize))}}class li extends ai{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Ce(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Ce(O(t.readValue().toHexString(),20))}}class ci extends ai{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const fi=new y($r);function di(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&"object"==typeof r){let t={};i=e.map((e=>{const i=e.localName;return i||fi.throwError("cannot encode object for signature with missing names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[i]&&fi.throwError("cannot encode object for signature with duplicate names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[i]=!0,r[i]}))}else fi.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&fi.throwArgumentError("types/value length mismatch","tuple",r);let n=new hi(t.wordSize),o=new hi(t.wordSize),s=[];e.forEach(((t,e)=>{let r=i[e];if(t.dynamic){let e=o.length;t.encode(o,r);let i=n.writeUpdatableValue();s.push((t=>{i(t+e)}))}else t.encode(n,r)})),s.forEach((t=>{t(n.length)}));let a=t.appendWriter(n);return a+=t.appendWriter(o),a}function mi(t,e){let r=[],i=t.subReader(0);e.forEach((e=>{let n=null;if(e.dynamic){let r=t.readValue(),o=i.subReader(r.toNumber());try{n=e.decode(o)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;n=t,n.baseType=e.name,n.name=e.localName,n.type=e.type}}else try{n=e.decode(t)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;n=t,n.baseType=e.name,n.name=e.localName,n.type=e.type}null!=n&&r.push(n)}));const n=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let i=t.localName;if(!i||1!==n[i])return;if("length"===i&&(i="_length"),null!=r[i])return;const o=r[e];o instanceof Error?Object.defineProperty(r,i,{enumerable:!0,get:()=>{throw o}}):r[i]=o}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class pi extends ai{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),fi.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let i=[];for(let t=0;t<e.length;t++)i.push(this.coder);return di(t,i,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&fi.throwError("insufficient data length",y.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new ci(this.coder));return t.coerce(this.name,mi(t,r))}}class gi extends ai{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class yi extends ai{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=A(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class vi extends yi{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,I(super.decode(t)))}}class wi extends ai{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=A(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,I(t.readBytes(this.size)))}}class bi extends ai{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}var Mi=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var _i=Mi.BN;const Ei=new y("bignumber/5.6.2"),Ai={},ki=9007199254740991;let xi=!1;class Ni{constructor(t,e){t!==Ai&&Ei.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Ii(Ri(this).fromTwos(t))}toTwos(t){return Ii(Ri(this).toTwos(t))}abs(){return"-"===this._hex[0]?Ni.from(this._hex.substring(1)):this}add(t){return Ii(Ri(this).add(Ri(t)))}sub(t){return Ii(Ri(this).sub(Ri(t)))}div(t){return Ni.from(t).isZero()&&Ti("division-by-zero","div"),Ii(Ri(this).div(Ri(t)))}mul(t){return Ii(Ri(this).mul(Ri(t)))}mod(t){const e=Ri(t);return e.isNeg()&&Ti("division-by-zero","mod"),Ii(Ri(this).umod(e))}pow(t){const e=Ri(t);return e.isNeg()&&Ti("negative-power","pow"),Ii(Ri(this).pow(e))}and(t){const e=Ri(t);return(this.isNegative()||e.isNeg())&&Ti("unbound-bitwise-result","and"),Ii(Ri(this).and(e))}or(t){const e=Ri(t);return(this.isNegative()||e.isNeg())&&Ti("unbound-bitwise-result","or"),Ii(Ri(this).or(e))}xor(t){const e=Ri(t);return(this.isNegative()||e.isNeg())&&Ti("unbound-bitwise-result","xor"),Ii(Ri(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ti("negative-width","mask"),Ii(Ri(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ti("negative-width","shl"),Ii(Ri(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ti("negative-width","shr"),Ii(Ri(this).shrn(t))}eq(t){return Ri(this).eq(Ri(t))}lt(t){return Ri(this).lt(Ri(t))}lte(t){return Ri(this).lte(Ri(t))}gt(t){return Ri(this).gt(Ri(t))}gte(t){return Ri(this).gte(Ri(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ri(this).isZero()}toNumber(){try{return Ri(this).toNumber()}catch(t){Ti("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ei.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?xi||(xi=!0,Ei.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ei.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Ei.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Ri(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ni)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ni(Ai,Si(t)):t.match(/^-?[0-9]+$/)?new Ni(Ai,Si(new _i(t))):Ei.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ti("underflow","BigNumber.from",t),(t>=ki||t<=-ki)&&Ti("overflow","BigNumber.from",t),Ni.from(String(t));const e=t;if("bigint"==typeof e)return Ni.from(e.toString());if(E(e))return Ni.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ni.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return Ni.from(t)}return Ei.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Si(t){if("string"!=typeof t)return Si(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ei.throwArgumentError("invalid hex","value",t),"0x00"===(t=Si(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 Ii(t){return Ni.from(Si(t))}function Ri(t){const e=Ni.from(t).toHexString();return"-"===e[0]?new _i("-"+e.substring(3),16):new _i(e.substring(2),16)}function Ti(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Ei.throwError(t,y.errors.NUMERIC_FAULT,i)}const Ci=Ni.from(-1),Pi=Ni.from(0),Oi=Ni.from(1),Bi=Ni.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class $i extends ai{constructor(t,e,r){const i=(e?"int":"uint")+8*t;super(i,i,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=br.from(e),i=Bi.mask(8*t.wordSize);if(this.signed){let t=i.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(Oi).mul(Ci)))&&this._throwError("value out-of-bounds",e)}else(r.lt(Pi)||r.gt(i.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}const Ui=new y("strings/5.6.1");var Di,Li;function Fi(t,e,r,i,n){if(t===Li.BAD_PREFIX||t===Li.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===Li.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Di||(Di={})),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"}(Li||(Li={}));const ji=Object.freeze({error:function(t,e,r,i,n){return Ui.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Fi,replace:function(t,e,r,i,n){return t===Li.OVERLONG?(i.push(n),0):(i.push(65533),Fi(t,e,r))}});function zi(t,e){null==e&&(e=ji.error),t=A(t);const r=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,s=null;if(192==(224&n))o=1,s=127;else if(224==(240&n))o=2,s=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?Li.UNEXPECTED_CONTINUE:Li.BAD_PREFIX,i-1,t,r);continue}o=3,s=65535}if(i-1+o>=t.length){i+=e(Li.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let n=0;n<o;n++){let n=t[i];if(128!=(192&n)){i+=e(Li.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|63&n,i++}null!==a&&(a>1114111?i+=e(Li.OUT_OF_RANGE,i-1-o,t,r,a):a>=55296&&a<=57343?i+=e(Li.UTF16_SURROGATE,i-1-o,t,r,a):a<=s?i+=e(Li.OVERLONG,i-1-o,t,r,a):r.push(a))}return r}function qi(t,e=Di.current){e!=Di.current&&(Ui.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return A(r)}function Hi(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Vi(t,e){return Hi(zi(t,e))}function Zi(t,e=Di.current){return zi(qi(t,e))}function Gi(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,i={};return t.split(",").forEach((t=>{let n=t.split(":");r+=parseInt(n[0],16),i[r]=e(n[1])})),i}function Ki(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let i=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:i,h:e}}))}function Ji(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];if(r+=n.l,t>=r&&t<=r+n.h&&(t-r)%(n.d||1)==0){if(n.e&&-1!==n.e.indexOf(t-r))continue;return n}}return null}const Qi=Ki("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Wi="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Yi=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Xi=Gi("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),tn=Gi("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),en=Gi("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),rn=Ki("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function nn(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Zi(t);var r;r=e.map((t=>{if(Wi.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Ji(t,Yi);if(e)return[t+e.s];let r=Xi[t];if(r)return r;let i=tn[t];return i?[t+i[0]]:en[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Zi(Hi(e),Di.NFKC),e.forEach((t=>{if(Ji(t,rn))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(Ji(t,Qi))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let i=Hi(e);if("-"===i.substring(0,1)||"--"===i.substring(2,4)||"-"===i.substring(i.length-1))throw new Error("invalid hyphen");if(i.length>63)throw new Error("too long");return i}class on extends yi{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,qi(e))}decode(t){return Vi(super.decode(t))}}class sn extends ai{constructor(t,e){let r=!1;const i=[];t.forEach((t=>{t.dynamic&&(r=!0),i.push(t.type)}));super("tuple","tuple("+i.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,i)=>{let n=r.localName;n&&1===e[n]&&("length"===n&&(n="_length"),null==t[n]&&(t[n]=t[i]))})),Object.freeze(t)}encode(t,e){return di(t,this.coders,e)}decode(t){return t.coerce(this.name,mi(t,this.coders))}}const an=new y($r),hn=new RegExp(/^bytes([0-9]*)$/),un=new RegExp(/^(u?int)([0-9]*)$/);class ln{constructor(t){Nr(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new li(t.name);case"bool":return new gi(t.name);case"string":return new on(t.name);case"bytes":return new vi(t.name);case"array":return new pi(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new sn((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new bi(t.name)}let e=t.type.match(un);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&an.throwArgumentError("invalid "+e[1]+" bit length","param",t),new $i(r/8,"int"===e[1],t.name)}if(e=t.type.match(hn),e){let r=parseInt(e[1]);return(0===r||r>32)&&an.throwArgumentError("invalid bytes length","param",t),new wi(r,t.name)}return an.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new ui(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new hi(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Vr.from(t))));return new sn(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&an.throwError("types/values length mismatch",y.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Vr.from(t)))),i=new sn(r,"_"),n=this._getWriter();return i.encode(n,e),n.data}decode(t,e,r){const i=t.map((t=>this._getCoder(Vr.from(t))));return new sn(i,"_").decode(this._getReader(A(e),r))}}const cn=new ln;function fn(t){return we(qi(t))}const dn=new y($r);class mn extends Br{}class pn extends Br{}class gn extends Br{}class yn extends Br{static isIndexed(t){return!(!t||!t._isIndexed)}}const vn={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function wn(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class bn{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,Nr(this,"fragments",e.map((t=>Gr.from(t))).filter((t=>null!=t))),Nr(this,"_abiCoder",Sr(new.target,"getAbiCoder")()),Nr(this,"functions",{}),Nr(this,"errors",{}),Nr(this,"events",{}),Nr(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void dn.warn("duplicate definition - constructor"):void Nr(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?dn.warn("duplicate definition - "+r):e[r]=t})),this.deploy||Nr(this,"deploy",Yr.from({payable:!1,type:"constructor"})),Nr(this,"_isInterface",!0)}format(t){t||(t=qr.full),t===qr.sighash&&dn.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===qr.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return cn}static getAddress(t){return Ce(t)}static getSighash(t){return T(fn(t.format()),0,4)}static getEventTopic(t){return fn(t.format())}getFunction(t){if(N(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];dn.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?dn.throwArgumentError("no matching function","name",e):r.length>1&&dn.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[Xr.fromString(t).format()];return e||dn.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(N(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];dn.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?dn.throwArgumentError("no matching event","name",e):r.length>1&&dn.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Kr.fromString(t).format()];return e||dn.throwArgumentError("no matching event","signature",t),e}getError(t){if(N(t)){const e=Sr(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}dn.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?dn.throwArgumentError("no matching error","name",e):r.length>1&&dn.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[Xr.fromString(t).format()];return e||dn.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Sr(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Sr(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=A(e);return I(r.slice(0,4))!==this.getSighash(t)&&dn.throwArgumentError(`data signature does not match error ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),I(k([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=A(e);return I(r.slice(0,4))!==this.getSighash(t)&&dn.throwArgumentError(`data signature does not match function ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(k([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=A(e),i=null,n="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=I(r.slice(0,4)),e=vn[t];if(e)o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.signature,e.reason&&(i=o[0]),"Error"===s?n=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(n=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.format()}catch(t){}break}}return dn.throwError("call revert exception"+n,y.errors.CALL_EXCEPTION,{method:t.format(),data:I(e),errorArgs:o,errorName:s,errorSignature:a,reason:i})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&dn.throwError("too many arguments for "+t.format(),y.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const i=(t,e)=>"string"===t.type?fn(e):"bytes"===t.type?we(I(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=br.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),O(I(e),32));for(e.forEach(((e,n)=>{let o=t.inputs[n];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?dn.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>i(o,t)))):r.push(i(o,e)):null!=e&&dn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],i=[],n=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&dn.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(fn(s));else if("bytes"===t.type)r.push(we(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else i.push(t),n.push(s)})),{data:this._abiCoder.encode(i,n),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);N(r[0],32)&&r[0].toLowerCase()===e||dn.throwError("fragment/topic mismatch",y.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let i=[],n=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(i.push(Vr.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(i.push(t),o.push(!1)):(n.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(i,k(r)):null,a=this._abiCoder.decode(n,e,!0),h=[],u=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)h[e]=new yn({_isIndexed:!0,hash:null});else if(o[e])h[e]=new yn({_isIndexed:!0,hash:s[l++]});else try{h[e]=s[l++]}catch(t){h[e]=t}else try{h[e]=a[u++]}catch(t){h[e]=t}if(t.name&&null==h[t.name]){const r=h[e];r instanceof Error?Object.defineProperty(h,t.name,{enumerable:!0,get:()=>{throw wn(`property ${JSON.stringify(t.name)}`,r)}}):h[t.name]=r}}));for(let t=0;t<h.length;t++){const e=h[t];e instanceof Error&&Object.defineProperty(h,t,{enumerable:!0,get:()=>{throw wn(`index ${t}`,e)}})}return Object.freeze(h)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new pn({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:br.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new mn({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=I(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new gn({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var Mn=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var _n=Mn.BN;const En=new y("bignumber/5.6.2"),An={},kn=9007199254740991;let xn=!1;class Nn{constructor(t,e){t!==An&&En.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return In(Rn(this).fromTwos(t))}toTwos(t){return In(Rn(this).toTwos(t))}abs(){return"-"===this._hex[0]?Nn.from(this._hex.substring(1)):this}add(t){return In(Rn(this).add(Rn(t)))}sub(t){return In(Rn(this).sub(Rn(t)))}div(t){return Nn.from(t).isZero()&&Tn("division-by-zero","div"),In(Rn(this).div(Rn(t)))}mul(t){return In(Rn(this).mul(Rn(t)))}mod(t){const e=Rn(t);return e.isNeg()&&Tn("division-by-zero","mod"),In(Rn(this).umod(e))}pow(t){const e=Rn(t);return e.isNeg()&&Tn("negative-power","pow"),In(Rn(this).pow(e))}and(t){const e=Rn(t);return(this.isNegative()||e.isNeg())&&Tn("unbound-bitwise-result","and"),In(Rn(this).and(e))}or(t){const e=Rn(t);return(this.isNegative()||e.isNeg())&&Tn("unbound-bitwise-result","or"),In(Rn(this).or(e))}xor(t){const e=Rn(t);return(this.isNegative()||e.isNeg())&&Tn("unbound-bitwise-result","xor"),In(Rn(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Tn("negative-width","mask"),In(Rn(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Tn("negative-width","shl"),In(Rn(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Tn("negative-width","shr"),In(Rn(this).shrn(t))}eq(t){return Rn(this).eq(Rn(t))}lt(t){return Rn(this).lt(Rn(t))}lte(t){return Rn(this).lte(Rn(t))}gt(t){return Rn(this).gt(Rn(t))}gte(t){return Rn(this).gte(Rn(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Rn(this).isZero()}toNumber(){try{return Rn(this).toNumber()}catch(t){Tn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return En.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?xn||(xn=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Rn(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Nn)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Nn(An,Sn(t)):t.match(/^-?[0-9]+$/)?new Nn(An,Sn(new _n(t))):En.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Tn("underflow","BigNumber.from",t),(t>=kn||t<=-kn)&&Tn("overflow","BigNumber.from",t),Nn.from(String(t));const e=t;if("bigint"==typeof e)return Nn.from(e.toString());if(E(e))return Nn.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Nn.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return Nn.from(t)}return En.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Sn(t){if("string"!=typeof t)return Sn(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&En.throwArgumentError("invalid hex","value",t),"0x00"===(t=Sn(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 In(t){return Nn.from(Sn(t))}function Rn(t){const e=Nn.from(t).toHexString();return"-"===e[0]?new _n("-"+e.substring(3),16):new _n(e.substring(2),16)}function Tn(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),En.throwError(t,y.errors.NUMERIC_FAULT,i)}var Cn=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Pn=new y("abstract-provider/5.6.1");class On extends Br{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Bn{constructor(){Pn.checkAbstract(new.target,Bn),Nr(this,"_isProvider",!0)}getFeeData(){return Cn(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield Ir({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let r=null,i=null;return t&&t.baseFeePerGas&&(i=Nn.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var $n=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Un=new y("abstract-signer/5.6.2"),Dn=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Ln=[y.errors.INSUFFICIENT_FUNDS,y.errors.NONCE_EXPIRED,y.errors.REPLACEMENT_UNDERPRICED];class Fn{constructor(){Un.checkAbstract(new.target,Fn),Nr(this,"_isSigner",!0)}getBalance(t){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return $n(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Ir(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return $n(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield Ir(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return $n(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return $n(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return $n(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return $n(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===Dn.indexOf(e)&&Un.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=Rr(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&Un.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return $n(this,void 0,void 0,(function*(){const e=yield Ir(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>$n(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&Un.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||Un.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):Un.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&Un.throwError("network does not support EIP-1559",y.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):Un.throwError("failed to get consistent fee data",y.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(Ln.indexOf(t.code)>=0)throw t;return Un.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&Un.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Ir(e)}))}_checkProvider(t){this.provider||Un.throwError("missing provider",y.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class jn extends Fn{constructor(t,e){super(),Nr(this,"address",t),Nr(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{Un.throwError(t,y.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new jn(this.address,t)}}var zn=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var qn=zn.BN;const Hn=new y("bignumber/5.6.2"),Vn={},Zn=9007199254740991;let Gn=!1;class Kn{constructor(t,e){t!==Vn&&Hn.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Qn(Wn(this).fromTwos(t))}toTwos(t){return Qn(Wn(this).toTwos(t))}abs(){return"-"===this._hex[0]?Kn.from(this._hex.substring(1)):this}add(t){return Qn(Wn(this).add(Wn(t)))}sub(t){return Qn(Wn(this).sub(Wn(t)))}div(t){return Kn.from(t).isZero()&&Yn("division-by-zero","div"),Qn(Wn(this).div(Wn(t)))}mul(t){return Qn(Wn(this).mul(Wn(t)))}mod(t){const e=Wn(t);return e.isNeg()&&Yn("division-by-zero","mod"),Qn(Wn(this).umod(e))}pow(t){const e=Wn(t);return e.isNeg()&&Yn("negative-power","pow"),Qn(Wn(this).pow(e))}and(t){const e=Wn(t);return(this.isNegative()||e.isNeg())&&Yn("unbound-bitwise-result","and"),Qn(Wn(this).and(e))}or(t){const e=Wn(t);return(this.isNegative()||e.isNeg())&&Yn("unbound-bitwise-result","or"),Qn(Wn(this).or(e))}xor(t){const e=Wn(t);return(this.isNegative()||e.isNeg())&&Yn("unbound-bitwise-result","xor"),Qn(Wn(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Yn("negative-width","mask"),Qn(Wn(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Yn("negative-width","shl"),Qn(Wn(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Yn("negative-width","shr"),Qn(Wn(this).shrn(t))}eq(t){return Wn(this).eq(Wn(t))}lt(t){return Wn(this).lt(Wn(t))}lte(t){return Wn(this).lte(Wn(t))}gt(t){return Wn(this).gt(Wn(t))}gte(t){return Wn(this).gte(Wn(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Wn(this).isZero()}toNumber(){try{return Wn(this).toNumber()}catch(t){Yn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Hn.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Gn||(Gn=!0,Hn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Hn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Hn.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Wn(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Kn)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Kn(Vn,Jn(t)):t.match(/^-?[0-9]+$/)?new Kn(Vn,Jn(new qn(t))):Hn.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Yn("underflow","BigNumber.from",t),(t>=Zn||t<=-Zn)&&Yn("overflow","BigNumber.from",t),Kn.from(String(t));const e=t;if("bigint"==typeof e)return Kn.from(e.toString());if(E(e))return Kn.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Kn.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return Kn.from(t)}return Hn.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Jn(t){if("string"!=typeof t)return Jn(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Hn.throwArgumentError("invalid hex","value",t),"0x00"===(t=Jn(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 Qn(t){return Kn.from(Jn(t))}function Wn(t){const e=Kn.from(t).toHexString();return"-"===e[0]?new qn("-"+e.substring(3),16):new qn(e.substring(2),16)}function Yn(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Hn.throwError(t,y.errors.NUMERIC_FAULT,i)}var Xn=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var to=Xn.BN;const eo=new y("bignumber/5.6.2"),ro={},io=9007199254740991;let no=!1;class oo{constructor(t,e){t!==ro&&eo.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ao(ho(this).fromTwos(t))}toTwos(t){return ao(ho(this).toTwos(t))}abs(){return"-"===this._hex[0]?oo.from(this._hex.substring(1)):this}add(t){return ao(ho(this).add(ho(t)))}sub(t){return ao(ho(this).sub(ho(t)))}div(t){return oo.from(t).isZero()&&uo("division-by-zero","div"),ao(ho(this).div(ho(t)))}mul(t){return ao(ho(this).mul(ho(t)))}mod(t){const e=ho(t);return e.isNeg()&&uo("division-by-zero","mod"),ao(ho(this).umod(e))}pow(t){const e=ho(t);return e.isNeg()&&uo("negative-power","pow"),ao(ho(this).pow(e))}and(t){const e=ho(t);return(this.isNegative()||e.isNeg())&&uo("unbound-bitwise-result","and"),ao(ho(this).and(e))}or(t){const e=ho(t);return(this.isNegative()||e.isNeg())&&uo("unbound-bitwise-result","or"),ao(ho(this).or(e))}xor(t){const e=ho(t);return(this.isNegative()||e.isNeg())&&uo("unbound-bitwise-result","xor"),ao(ho(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&uo("negative-width","mask"),ao(ho(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&uo("negative-width","shl"),ao(ho(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&uo("negative-width","shr"),ao(ho(this).shrn(t))}eq(t){return ho(this).eq(ho(t))}lt(t){return ho(this).lt(ho(t))}lte(t){return ho(this).lte(ho(t))}gt(t){return ho(this).gt(ho(t))}gte(t){return ho(this).gte(ho(t))}isNegative(){return"-"===this._hex[0]}isZero(){return ho(this).isZero()}toNumber(){try{return ho(this).toNumber()}catch(t){uo("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return eo.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?no||(no=!0,eo.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?eo.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):eo.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),ho(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof oo)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new oo(ro,so(t)):t.match(/^-?[0-9]+$/)?new oo(ro,so(new to(t))):eo.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&uo("underflow","BigNumber.from",t),(t>=io||t<=-io)&&uo("overflow","BigNumber.from",t),oo.from(String(t));const e=t;if("bigint"==typeof e)return oo.from(e.toString());if(E(e))return oo.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return oo.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return oo.from(t)}return eo.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function so(t){if("string"!=typeof t)return so(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&eo.throwArgumentError("invalid hex","value",t),"0x00"===(t=so(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 ao(t){return oo.from(so(t))}function ho(t){const e=oo.from(t).toHexString();return"-"===e[0]?new to("-"+e.substring(3),16):new to(e.substring(2),16)}function uo(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),eo.throwError(t,y.errors.NUMERIC_FAULT,i)}var lo=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)})),co=fo;function fo(t,e){if(!t)throw new Error(e||"Assertion failed")}function mo(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function po(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function go(t){return 1===t.length?"0"+t:t}function yo(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}fo.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var vo={inherits:o((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}}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):mo(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},toHex:function(t){for(var e="",r=0;r<t.length;r++)e+=go(t[r].toString(16));return e},htonl:po,toHex32:function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=po(n)),r+=yo(n.toString(16))}return r},zero2:go,zero8:yo,join32:function(t,e,r,i){var n=r-e;co(n%4==0);for(var o=new Array(n/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},split32:function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var o=t[i];"big"===e?(r[n]=o>>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<<e|t>>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,r){return t+e+r>>>0},sum32_4:function(t,e,r,i){return t+e+r+i>>>0},sum32_5:function(t,e,r,i,n){return t+e+r+i+n>>>0},sum64:function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o<i?1:0)+r+n;t[e]=s>>>0,t[e+1]=o},sum64_hi:function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},sum64_lo:function(t,e,r,i){return e+i>>>0},sum64_4_hi:function(t,e,r,i,n,o,s,a){var h=0,u=e;return h+=(u=u+i>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+n+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},sum64_5_hi:function(t,e,r,i,n,o,s,a,h,u){var l=0,c=e;return l+=(c=c+i>>>0)<e?1:0,l+=(c=c+o>>>0)<o?1:0,l+=(c=c+a>>>0)<a?1:0,t+r+n+s+h+(l+=(c=c+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(t,e,r,i,n,o,s,a,h,u){return e+i+o+a+u>>>0},rotr64_hi:function(t,e,r){return(e<<32-r|t>>>r)>>>0},rotr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0},shr64_hi:function(t,e,r){return t>>>r},shr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0}};function wo(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var bo=wo;wo.prototype.update=function(t,e){if(t=vo.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=vo.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},wo.prototype.digest=function(t){return this.update(this._pad()),co(null===this.pending),this._digest(t)},wo.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o<this.padLength;o++)i[n++]=0;return i};var Mo={BlockHash:bo},_o=vo.rotr32;var Eo=function(t,e,r,i){return 0===t?Ao(e,r,i):1===t||3===t?xo(e,r,i):2===t?ko(e,r,i):void 0};function Ao(t,e,r){return t&e^~t&r}function ko(t,e,r){return t&e^t&r^e&r}function xo(t,e,r){return t^e^r}var No=function(t){return _o(t,2)^_o(t,13)^_o(t,22)};var So=function(t){return _o(t,6)^_o(t,11)^_o(t,25)};var Io=function(t){return _o(t,7)^_o(t,18)^t>>>3};var Ro=function(t){return _o(t,17)^_o(t,19)^t>>>10},To={ft_1:Eo,ch32:Ao,maj32:ko,p32:xo,s0_256:No,s1_256:So,g0_256:Io,g1_256:Ro},Co=vo.rotl32,Po=vo.sum32,Oo=vo.sum32_5,Bo=To.ft_1,$o=Mo.BlockHash,Uo=[1518500249,1859775393,2400959708,3395469782];function Do(){if(!(this instanceof Do))return new Do;$o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}vo.inherits(Do,$o);var Lo=Do;Do.blockSize=512,Do.outSize=160,Do.hmacStrength=80,Do.padLength=64,Do.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Co(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var u=~~(i/20),l=Oo(Co(n,5),Bo(u,o,s,a),h,r[i],Uo[u]);h=a,a=s,s=Co(o,30),o=n,n=l}this.h[0]=Po(this.h[0],n),this.h[1]=Po(this.h[1],o),this.h[2]=Po(this.h[2],s),this.h[3]=Po(this.h[3],a),this.h[4]=Po(this.h[4],h)},Do.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"big"):vo.split32(this.h,"big")};var Fo=vo.sum32,jo=vo.sum32_4,zo=vo.sum32_5,qo=To.ch32,Ho=To.maj32,Vo=To.s0_256,Zo=To.s1_256,Go=To.g0_256,Ko=To.g1_256,Jo=Mo.BlockHash,Qo=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Wo(){if(!(this instanceof Wo))return new Wo;Jo.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Qo,this.W=new Array(64)}vo.inherits(Wo,Jo);var Yo=Wo;function Xo(){if(!(this instanceof Xo))return new Xo;Yo.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Wo.blockSize=512,Wo.outSize=256,Wo.hmacStrength=192,Wo.padLength=64,Wo.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=jo(Ko(r[i-2]),r[i-7],Go(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],l=this.h[6],c=this.h[7];for(co(this.k.length===r.length),i=0;i<r.length;i++){var f=zo(c,Zo(h),qo(h,u,l),this.k[i],r[i]),d=Fo(Vo(n),Ho(n,o,s));c=l,l=u,u=h,h=Fo(a,f),a=s,s=o,o=n,n=Fo(f,d)}this.h[0]=Fo(this.h[0],n),this.h[1]=Fo(this.h[1],o),this.h[2]=Fo(this.h[2],s),this.h[3]=Fo(this.h[3],a),this.h[4]=Fo(this.h[4],h),this.h[5]=Fo(this.h[5],u),this.h[6]=Fo(this.h[6],l),this.h[7]=Fo(this.h[7],c)},Wo.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"big"):vo.split32(this.h,"big")},vo.inherits(Xo,Yo);var ts=Xo;Xo.blockSize=512,Xo.outSize=224,Xo.hmacStrength=192,Xo.padLength=64,Xo.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h.slice(0,7),"big"):vo.split32(this.h.slice(0,7),"big")};var es=vo.rotr64_hi,rs=vo.rotr64_lo,is=vo.shr64_hi,ns=vo.shr64_lo,os=vo.sum64,ss=vo.sum64_hi,as=vo.sum64_lo,hs=vo.sum64_4_hi,us=vo.sum64_4_lo,ls=vo.sum64_5_hi,cs=vo.sum64_5_lo,fs=Mo.BlockHash,ds=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ms(){if(!(this instanceof ms))return new ms;fs.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ds,this.W=new Array(160)}vo.inherits(ms,fs);var ps=ms;function gs(t,e,r,i,n){var o=t&r^~t&n;return o<0&&(o+=4294967296),o}function ys(t,e,r,i,n,o){var s=e&i^~e&o;return s<0&&(s+=4294967296),s}function vs(t,e,r,i,n){var o=t&r^t&n^r&n;return o<0&&(o+=4294967296),o}function ws(t,e,r,i,n,o){var s=e&i^e&o^i&o;return s<0&&(s+=4294967296),s}function bs(t,e){var r=es(t,e,28)^es(e,t,2)^es(e,t,7);return r<0&&(r+=4294967296),r}function Ms(t,e){var r=rs(t,e,28)^rs(e,t,2)^rs(e,t,7);return r<0&&(r+=4294967296),r}function _s(t,e){var r=es(t,e,14)^es(t,e,18)^es(e,t,9);return r<0&&(r+=4294967296),r}function Es(t,e){var r=rs(t,e,14)^rs(t,e,18)^rs(e,t,9);return r<0&&(r+=4294967296),r}function As(t,e){var r=es(t,e,1)^es(t,e,8)^is(t,e,7);return r<0&&(r+=4294967296),r}function ks(t,e){var r=rs(t,e,1)^rs(t,e,8)^ns(t,e,7);return r<0&&(r+=4294967296),r}function xs(t,e){var r=es(t,e,19)^es(e,t,29)^is(t,e,6);return r<0&&(r+=4294967296),r}function Ns(t,e){var r=rs(t,e,19)^rs(e,t,29)^ns(t,e,6);return r<0&&(r+=4294967296),r}function Ss(){if(!(this instanceof Ss))return new Ss;ps.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ms.blockSize=1024,ms.outSize=512,ms.hmacStrength=192,ms.padLength=128,ms.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=xs(r[i-4],r[i-3]),o=Ns(r[i-4],r[i-3]),s=r[i-14],a=r[i-13],h=As(r[i-30],r[i-29]),u=ks(r[i-30],r[i-29]),l=r[i-32],c=r[i-31];r[i]=hs(n,o,s,a,h,u,l,c),r[i+1]=us(n,o,s,a,h,u,l,c)}},ms.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],l=this.h[7],c=this.h[8],f=this.h[9],d=this.h[10],m=this.h[11],p=this.h[12],g=this.h[13],y=this.h[14],v=this.h[15];co(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var b=y,M=v,_=_s(c,f),E=Es(c,f),A=gs(c,f,d,m,p),k=ys(c,f,d,m,p,g),x=this.k[w],N=this.k[w+1],S=r[w],I=r[w+1],R=ls(b,M,_,E,A,k,x,N,S,I),T=cs(b,M,_,E,A,k,x,N,S,I);b=bs(i,n),M=Ms(i,n),_=vs(i,n,o,s,a),E=ws(i,n,o,s,a,h);var C=ss(b,M,_,E),P=as(b,M,_,E);y=p,v=g,p=d,g=m,d=c,m=f,c=ss(u,l,R,T),f=as(l,l,R,T),u=a,l=h,a=o,h=s,o=i,s=n,i=ss(R,T,C,P),n=as(R,T,C,P)}os(this.h,0,i,n),os(this.h,2,o,s),os(this.h,4,a,h),os(this.h,6,u,l),os(this.h,8,c,f),os(this.h,10,d,m),os(this.h,12,p,g),os(this.h,14,y,v)},ms.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"big"):vo.split32(this.h,"big")},vo.inherits(Ss,ps);var Is=Ss;Ss.blockSize=1024,Ss.outSize=384,Ss.hmacStrength=192,Ss.padLength=128,Ss.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h.slice(0,12),"big"):vo.split32(this.h.slice(0,12),"big")};var Rs={sha1:Lo,sha224:ts,sha256:Yo,sha384:Is,sha512:ps},Ts=vo.rotl32,Cs=vo.sum32,Ps=vo.sum32_3,Os=vo.sum32_4,Bs=Mo.BlockHash;function $s(){if(!(this instanceof $s))return new $s;Bs.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}vo.inherits($s,Bs);var Us=$s;function Ds(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Ls(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Fs(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}$s.blockSize=512,$s.outSize=160,$s.hmacStrength=192,$s.padLength=64,$s.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],o=this.h[3],s=this.h[4],a=r,h=i,u=n,l=o,c=s,f=0;f<80;f++){var d=Cs(Ts(Os(r,Ds(f,i,n,o),t[js[f]+e],Ls(f)),qs[f]),s);r=s,s=o,o=Ts(n,10),n=i,i=d,d=Cs(Ts(Os(a,Ds(79-f,h,u,l),t[zs[f]+e],Fs(f)),Hs[f]),c),a=c,c=l,l=Ts(u,10),u=h,h=d}d=Ps(this.h[1],n,l),this.h[1]=Ps(this.h[2],o,c),this.h[2]=Ps(this.h[3],s,a),this.h[3]=Ps(this.h[4],r,h),this.h[4]=Ps(this.h[0],i,u),this.h[0]=d},$s.prototype._digest=function(t){return"hex"===t?vo.toHex32(this.h,"little"):vo.split32(this.h,"little")};var js=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zs=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],qs=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Hs=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Vs={ripemd160:Us};function Zs(t,e,r){if(!(this instanceof Zs))return new Zs(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(vo.toArray(e,r))}var Gs=Zs;Zs.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),co(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Zs.prototype.update=function(t,e){return this.inner.update(t,e),this},Zs.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var Ks=o((function(t,e){var r=e;r.utils=vo,r.common=Mo,r.sha=Rs,r.ripemd=Vs,r.hmac=Gs,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}));function Js(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}var Qs=Ws;function Ws(t,e){if(!t)throw new Error(e||"Assertion failed")}Ws.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Ys=Js((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}})),Xs=Js((function(t,e){var r=e;r.assert=Qs,r.toArray=Ys.toArray,r.zero2=Ys.zero2,r.toHex=Ys.toHex,r.encode=Ys.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 a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,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,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+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 lo(t,"hex","le")}})),ta=Xs.getNAF,ea=Xs.getJSF,ra=Xs.assert;function ia(t,e){this.type=t,this.p=new lo(e.p,16),this.red=e.prime?lo.red(e.prime):lo.mont(this.p),this.zero=new lo(0).toRed(this.red),this.one=new lo(1).toRed(this.red),this.two=new lo(2).toRed(this.red),this.n=e.n&&new lo(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 na=ia;function oa(t,e){this.curve=t,this.type=e,this.precomputed=null}ia.prototype.point=function(){throw new Error("Not implemented")},ia.prototype.validate=function(){throw new Error("Not implemented")},ia.prototype._fixedNafMul=function(t,e){ra(t.precomputed);var r=t._getDoubles(),i=ta(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),c=n;c>0;c--){for(o=0;o<a.length;o++)(s=a[o])===c?l=l.mixedAdd(r.points[o]):s===-c&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},ia.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=ta(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];ra(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},ia.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,c=0;for(o=0;o<i;o++){var f=(a=e[o])._getNAFPoints(t);h[o]=f.wnd,u[o]=f.points}for(o=i-1;o>=1;o-=2){var d=o-1,m=o;if(1===h[d]&&1===h[m]){var p=[e[d],null,null,e[m]];0===e[d].y.cmp(e[m].y)?(p[1]=e[d].add(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg())):0===e[d].y.cmp(e[m].y.redNeg())?(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].add(e[m].neg())):(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=ea(r[d],r[m]);for(c=Math.max(y[0].length,c),l[d]=new Array(c),l[m]=new Array(c),s=0;s<c;s++){var v=0|y[0][s],w=0|y[1][s];l[d][s]=g[3*(v+1)+(w+1)],l[m][s]=0,u[d]=p}}else l[d]=ta(r[d],h[d],this._bitLength),l[m]=ta(r[m],h[m],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[m].length,c)}var b=this.jpoint(null,null,null),M=this._wnafT4;for(o=c;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(s=0;s<i;s++)M[s]=0|l[s][o],0!==M[s]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,b=b.dblp(_),o<0)break;for(s=0;s<i;s++){var A=M[s];0!==A&&(A>0?a=u[s][A-1>>1]:A<0&&(a=u[s][-A-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?b:b.toP()},ia.BasePoint=oa,oa.prototype.eq=function(){throw new Error("Not implemented")},oa.prototype.validate=function(){return this.curve.validate(this)},ia.prototype.decodePoint=function(t,e){t=Xs.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]?ra(t[t.length-1]%2==0):7===t[0]&&ra(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")},oa.prototype.encodeCompressed=function(t){return this.encode(t,!0)},oa.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))},oa.prototype.encode=function(t,e){return Xs.encode(this._encode(e),t)},oa.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},oa.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)},oa.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}},oa.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}},oa.prototype._getBeta=function(){return null},oa.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var sa=Js((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}}})),aa=Xs.assert;function ha(t){na.call(this,"short",t),this.a=new lo(t.a,16).toRed(this.red),this.b=new lo(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)}sa(ha,na);var ua=ha;function la(t,e,r,i){na.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new lo(e,16),this.y=new lo(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 ca(t,e,r,i){na.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new lo(0)):(this.x=new lo(e,16),this.y=new lo(r,16),this.z=new lo(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}ha.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new lo(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 lo(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],aa(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 lo(t.a,16),b:new lo(t.b,16)}})):this._getEndoBasis(r)}}},ha.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:lo.mont(t),r=new lo(2).toRed(e).redInvm(),i=r.redNeg(),n=new lo(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},ha.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,f=this.n.clone(),d=new lo(1),m=new lo(0),p=new lo(0),g=new lo(1),y=0;0!==c.cmpn(0);){var v=f.div(c);h=f.sub(v.mul(c)),u=p.sub(v.mul(d));var w=g.sub(v.mul(m));if(!i&&h.cmp(l)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++y)break;a=h,f=c,c=h,p=d,d=u,g=m,m=w}o=h.neg(),s=u;var b=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(b)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},ha.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),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},ha.prototype.pointFromX=function(t,e){(t=new lo(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},ha.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)},ha.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]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,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},sa(la,na.BasePoint),ha.prototype.point=function(t,e,r){return new la(this,t,e,r)},ha.prototype.pointFromJSON=function(t,e){return la.fromJSON(this,t,e)},la.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}},la.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]},la.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},la.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)+">"},la.prototype.isInfinity=function(){return this.inf},la.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)},la.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)},la.prototype.getX=function(){return this.x.fromRed()},la.prototype.getY=function(){return this.y.fromRed()},la.prototype.mul=function(t){return t=new lo(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)},la.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)},la.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)},la.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))},la.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},la.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},sa(ca,na.BasePoint),ha.prototype.jpoint=function(t,e,r){return new ca(this,t,e,r)},ca.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)},ca.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},ca.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)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=i.redMul(u),f=h.redSqr().redIAdd(l).redISub(c).redISub(c),d=h.redMul(c.redISub(f)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,m)},ca.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),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),c=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(c)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},ca.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,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),c=u.redSqr(),f=c.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(h)),m=o.redMul(c),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),y=d.redMul(g);y=y.redIAdd(y).redISub(f);var v=u.redMul(a);e+1<t&&(h=h.redMul(f)),o=p,a=v,u=y}return this.curve.jpoint(o,u.redMul(n),a)},ca.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},ca.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 a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),c=this.y.redSqr(),f=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(l).redISub(f);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),e=m.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},ca.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 a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),c=this.y.redSqr(),f=this.x.redMul(c),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=f.redIAdd(f),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(l);var g=c.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},ca.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(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),c=u.redISub(l),f=s.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=a.redMul(c).redISub(f),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,d,m)},ca.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),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.x.redMul(a).redISub(l);c=(c=c.redIAdd(c)).redIAdd(c);var f=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,f,d)},ca.prototype.mul=function(t,e){return t=new lo(t,e),this.curve._wnafMul(this,t)},ca.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)},ca.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}},ca.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)+">"},ca.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var fa=Js((function(t,e){var r=e;r.base=na,r.short=ua,r.mont=null,r.edwards=null})),da=Js((function(t,e){var r,i=e,n=Xs.assert;function o(t){"short"===t.type?this.curve=new fa.short(t):"edwards"===t.type?this.curve=new fa.edwards(t):this.curve=new fa.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 s(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,s("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:Ks.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:Ks.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:Ks.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:Ks.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"]}),s("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:Ks.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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ks.sha256,gRed:!1,g:["9"]}),s("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:Ks.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("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:Ks.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function ma(t){if(!(this instanceof ma))return new ma(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=Ys.toArray(t.entropy,t.entropyEnc||"hex"),r=Ys.toArray(t.nonce,t.nonceEnc||"hex"),i=Ys.toArray(t.pers,t.persEnc||"hex");Qs(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var pa=ma;ma.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},ma.prototype._hmac=function(){return new Ks.hmac(this.hash,this.K)},ma.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())},ma.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=Ys.toArray(t,e),r=Ys.toArray(r,i),Qs(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},ma.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=Ys.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++,Ys.encode(o,e)};var ga=Xs.assert;function ya(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 va=ya;ya.fromPublic=function(t,e,r){return e instanceof ya?e:new ya(t,{pub:e,pubEnc:r})},ya.fromPrivate=function(t,e,r){return e instanceof ya?e:new ya(t,{priv:e,privEnc:r})},ya.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"}},ya.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},ya.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},ya.prototype._importPrivate=function(t,e){this.priv=new lo(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},ya.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?ga(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ga(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)},ya.prototype.derive=function(t){return t.validate()||ga(t.validate(),"public point not validated"),t.mul(this.priv).getX()},ya.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},ya.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},ya.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var wa=Xs.assert;function ba(t,e){if(t instanceof ba)return t;this._importDER(t,e)||(wa(t.r&&t.s,"Signature without r or s"),this.r=new lo(t.r,16),this.s=new lo(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Ma=ba;function _a(){this.place=0}function Ea(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 Aa(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 ka(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)}}ba.prototype._importDER=function(t,e){t=Xs.toArray(t,e);var r=new _a;if(48!==t[r.place++])return!1;var i=Ea(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=Ea(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=Ea(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new lo(o),this.s=new lo(a),this.recoveryParam=null,!0},ba.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=Aa(e),r=Aa(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];ka(i,e.length),(i=i.concat(e)).push(2),ka(i,r.length);var n=i.concat(r),o=[48];return ka(o,n.length),o=o.concat(n),Xs.encode(o,t)};var xa=function(){throw new Error("unsupported")},Na=Xs.assert;function Sa(t){if(!(this instanceof Sa))return new Sa(t);"string"==typeof t&&(Na(Object.prototype.hasOwnProperty.call(da,t),"Unknown curve "+t),t=da[t]),t instanceof da.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 Ia=Sa;Sa.prototype.keyPair=function(t){return new va(this,t)},Sa.prototype.keyFromPrivate=function(t,e){return va.fromPrivate(this,t,e)},Sa.prototype.keyFromPublic=function(t,e){return va.fromPublic(this,t,e)},Sa.prototype.genKeyPair=function(t){t||(t={});for(var e=new pa({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||xa(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new lo(2));;){var n=new lo(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Sa.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},Sa.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 lo(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),s=t.toArray("be",n),a=new pa({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new lo(1)),u=0;;u++){var l=i.k?i.k(u):new lo(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var c=this.g.mul(l);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var m=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var p=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),p^=1),new Ma({r:d,s:m,recoveryParam:p})}}}}}},Sa.prototype.verify=function(t,e,r,i){t=this._truncateToN(new lo(t,16)),r=this.keyFromPublic(r,i);var n=(e=new Ma(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),h=a.mul(t).umod(this.n),u=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(n):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(n)},Sa.prototype.recoverPubKey=function(t,e,r,i){Na((3&r)===r,"The recovery param is more than two bits"),e=new Ma(e,i);var n=this.n,o=new lo(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(n),c=n.sub(o).mul(l).umod(n),f=a.mul(l).umod(n);return this.g.mulAdd(c,s,f)},Sa.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new Ma(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 Ra=Js((function(t,e){var r=e;r.version="6.5.4",r.utils=Xs,r.rand=function(){throw new Error("unsupported")},r.curve=fa,r.curves=da,r.ec=Ia,r.eddsa=null})).ec;const Ta=new y("signing-key/5.6.2");let Ca=null;function Pa(){return Ca||(Ca=new Ra("secp256k1")),Ca}class Oa{constructor(t){Nr(this,"curve","secp256k1"),Nr(this,"privateKey",I(t)),32!==R(this.privateKey)&&Ta.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=Pa().keyFromPrivate(A(this.privateKey));Nr(this,"publicKey","0x"+e.getPublic(!1,"hex")),Nr(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Nr(this,"_isSigningKey",!0)}_addPoint(t){const e=Pa().keyFromPublic(A(this.publicKey)),r=Pa().keyFromPublic(A(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Pa().keyFromPrivate(A(this.privateKey)),r=A(t);32!==r.length&&Ta.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return B({recoveryParam:i.recoveryParam,r:O("0x"+i.r.toString(16),32),s:O("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=Pa().keyFromPrivate(A(this.privateKey)),r=Pa().keyFromPublic(A(Ba(t)));return O("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Ba(t,e){const r=A(t);if(32===r.length){const t=new Oa(r);return e?"0x"+Pa().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?I(r):"0x"+Pa().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Pa().keyFromPublic(r).getPublic(!0,"hex"):I(r):Ta.throwArgumentError("invalid public or private key","key","[REDACTED]")}const $a=new y("transactions/5.6.2");var Ua;function Da(t){return"0x"===t?null:Ce(t)}function La(t){return"0x"===t?Pi:oo.from(t)}function Fa(t,e){return function(t){return Ce(T(we(T(Ba(t),1)),12))}(function(t,e){const r=B(e),i={r:A(r.r),s:A(r.s)};return"0x"+Pa().recoverPubKey(A(t),i,r.recoveryParam).encode("hex",!1)}(A(t),e))}function ja(t,e){const r=x(oo.from(t).toHexString());return r.length>32&&$a.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function za(t,e){return{address:Ce(t),storageKeys:(e||[]).map(((e,r)=>(32!==R(e)&&$a.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function qa(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&$a.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),za(t[0],t[1])):za(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return za(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function Ha(t){return qa(t).map((t=>[t.address,t.storageKeys]))}function Va(t,e){if(null!=t.gasPrice){const e=oo.from(t.gasPrice),r=oo.from(t.maxFeePerGas||0);e.eq(r)||$a.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[ja(t.chainId||0,"chainId"),ja(t.nonce||0,"nonce"),ja(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ja(t.maxFeePerGas||0,"maxFeePerGas"),ja(t.gasLimit||0,"gasLimit"),null!=t.to?Ce(t.to):"0x",ja(t.value||0,"value"),t.data||"0x",Ha(t.accessList||[])];if(e){const t=B(e);r.push(ja(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return C(["0x02",Ae(r)])}function Za(t,e){const r=[ja(t.chainId||0,"chainId"),ja(t.nonce||0,"nonce"),ja(t.gasPrice||0,"gasPrice"),ja(t.gasLimit||0,"gasLimit"),null!=t.to?Ce(t.to):"0x",ja(t.value||0,"value"),t.data||"0x",Ha(t.accessList||[])];if(e){const t=B(e);r.push(ja(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return C(["0x01",Ae(r)])}function Ga(t,e,r){try{const r=La(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){$a.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=O(e[1],32),t.s=O(e[2],32);try{const e=we(r(t));t.from=Fa(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function Ka(t){const e=A(t);if(e[0]>127)return function(t){const e=Ne(t);9!==e.length&&6!==e.length&&$a.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:La(e[0]).toNumber(),gasPrice:La(e[1]),gasLimit:La(e[2]),to:Da(e[3]),value:La(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=oo.from(e[6]).toNumber()}catch(t){return r}if(r.r=O(e[7],32),r.s=O(e[8],32),oo.from(r.r).isZero()&&oo.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let i=r.v-27;const n=e.slice(0,6);0!==r.chainId&&(n.push(I(r.chainId)),n.push("0x"),n.push("0x"),i-=2*r.chainId+8);const o=we(Ae(n));try{r.from=Fa(o,{r:I(r.r),s:I(r.s),recoveryParam:i})}catch(t){}r.hash=we(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=Ne(t.slice(1));8!==e.length&&11!==e.length&&$a.throwArgumentError("invalid component count for transaction type: 1","payload",I(t));const r={type:1,chainId:La(e[0]).toNumber(),nonce:La(e[1]).toNumber(),gasPrice:La(e[2]),gasLimit:La(e[3]),to:Da(e[4]),value:La(e[5]),data:e[6],accessList:qa(e[7])};return 8===e.length||(r.hash=we(t),Ga(r,e.slice(8),Za)),r}(e);case 2:return function(t){const e=Ne(t.slice(1));9!==e.length&&12!==e.length&&$a.throwArgumentError("invalid component count for transaction type: 2","payload",I(t));const r=La(e[2]),i=La(e[3]),n={type:2,chainId:La(e[0]).toNumber(),nonce:La(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:i,gasPrice:null,gasLimit:La(e[4]),to:Da(e[5]),value:La(e[6]),data:e[7],accessList:qa(e[8])};return 9===e.length||(n.hash=we(t),Ga(n,e.slice(9),Va)),n}(e)}return $a.throwError(`unsupported transaction type: ${e[0]}`,y.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(Ua||(Ua={}));var Ja=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Qa=new y("contracts/5.6.2");function Wa(t,e){return Ja(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&Qa.throwArgumentError("invalid address or ENS name","name",r);try{return Ce(r)}catch(t){}t||Qa.throwError("a provider or signer is needed to resolve ENS names",y.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const i=yield t.resolveName(r);return null==i&&Qa.throwArgumentError("resolver or addr is not configured for ENS name","name",r),i}))}function Ya(t,e,r){return Ja(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,i)=>Ya(t,Array.isArray(e)?e[i]:e[r.name],r)))):"address"===r.type?yield Wa(t,e):"tuple"===r.type?yield Ya(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>Ya(t,e,r.arrayChildren)))):Promise.reject(Qa.makeError("invalid value for array",y.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function Xa(t,e,r){return Ja(this,void 0,void 0,(function*(){let i={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(i=Rr(r.pop())),Qa.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?i.from?i.from=Ir({override:Wa(t.signer,i.from),signer:t.signer.getAddress()}).then((t=>Ja(this,void 0,void 0,(function*(){return Ce(t.signer)!==t.override&&Qa.throwError("Contract with a Signer cannot override from",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):i.from=t.signer.getAddress():i.from&&(i.from=Wa(t.provider,i.from));const n=yield Ir({args:Ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:Ir(i)||{}}),o=t.interface.encodeFunctionData(e,n.args),s={data:o,to:n.address},a=n.overrides;if(null!=a.nonce&&(s.nonce=Kn.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=Kn.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=Kn.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=Kn.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=Kn.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=qa(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=A(o);for(let e=0;e<r.length;e++)t+=4,r[e]&&(t+=64);s.gasLimit=Kn.from(e.gas).add(t)}if(a.value){const t=Kn.from(a.value);t.isZero()||e.payable||Qa.throwError("non-payable method cannot override value",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:i.value}),s.value=t}a.customData&&(s.customData=Rr(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete i.nonce,delete i.gasLimit,delete i.gasPrice,delete i.from,delete i.value,delete i.type,delete i.accessList,delete i.maxFeePerGas,delete i.maxPriorityFeePerGas,delete i.customData,delete i.ccipReadEnabled;const h=Object.keys(i).filter((t=>null!=i[t]));return h.length&&Qa.throwError(`cannot override ${h.map((t=>JSON.stringify(t))).join(",")}`,y.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:h}),s}))}function th(t,e,r){const i=t.signer||t.provider;return function(...n){return Ja(this,void 0,void 0,(function*(){let o;if(n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]){const t=Rr(n.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,n.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield Xa(t,e,n),a=yield i.call(s,o);try{let i=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(i=i[0]),i}catch(e){throw e.code===y.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=n,e.transaction=s),e}}))}}function eh(t,e){return function(...r){return Ja(this,void 0,void 0,(function*(){t.signer||Qa.throwError("sending a transaction requires a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const i=yield Xa(t,e,r),n=yield t.signer.sendTransaction(i);return function(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let i=Or(r),n=null;try{n=t.interface.parseLog(r)}catch(t){}return n&&(i.args=n.args,i.decode=(e,r)=>t.interface.decodeEventLog(n.eventFragment,e,r),i.event=n.name,i.eventSignature=n.signature),i.removeListener=()=>t.provider,i.getBlock=()=>t.provider.getBlock(e.blockHash),i.getTransaction=()=>t.provider.getTransaction(e.transactionHash),i.getTransactionReceipt=()=>Promise.resolve(e),i})),e)))}(t,n),n}))}}function rh(t,e,r){return e.constant?th(t,e,r):eh(t,e)}function ih(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class nh{constructor(t,e){Nr(this,"tag",t),Nr(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class oh extends nh{constructor(){super("error",null)}}class sh extends nh{constructor(t,e,r,i){const n={address:t};let o=e.getEventTopic(r);i?(o!==i[0]&&Qa.throwArgumentError("topic mismatch","topics",i),n.topics=i.slice()):n.topics=[o],super(ih(n),n),Nr(this,"address",t),Nr(this,"interface",e),Nr(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],r=function(t,i){if(Array.isArray(i))for(let n in i){const o=t.slice();o.push(n);try{r(o,i[n])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class ah extends nh{constructor(t,e){super("*",{address:t}),Nr(this,"address",t),Nr(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class hh extends class{constructor(t,e,r){Nr(this,"interface",Sr(new.target,"getInterface")(e)),null==r?(Nr(this,"provider",null),Nr(this,"signer",null)):Fn.isSigner(r)?(Nr(this,"provider",r.provider||null),Nr(this,"signer",r)):Bn.isProvider(r)?(Nr(this,"provider",r),Nr(this,"signer",null)):Qa.throwArgumentError("invalid signer or provider","signerOrProvider",r),Nr(this,"callStatic",{}),Nr(this,"estimateGas",{}),Nr(this,"functions",{}),Nr(this,"populateTransaction",{}),Nr(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];Nr(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?Nr(this.filters,e,this.filters[r[0]]):Qa.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if(Nr(this,"_runningEvents",{}),Nr(this,"_wrappedEmits",{}),null==t&&Qa.throwArgumentError("invalid contract address or ENS name","addressOrName",t),Nr(this,"address",t),this.provider)Nr(this,"resolvedAddress",Wa(this.provider,t));else try{Nr(this,"resolvedAddress",Promise.resolve(Ce(t)))}catch(t){Qa.throwError("provider is required to use ENS name as contract address",y.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const i={},n={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(n[t])Qa.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{n[t]=!0;{const r=e.name;i[`%${r}`]||(i[`%${r}`]=[]),i[`%${r}`].push(t)}null==this[t]&&Nr(this,t,rh(this,e,!0)),null==this.functions[t]&&Nr(this.functions,t,rh(this,e,!1)),null==this.callStatic[t]&&Nr(this.callStatic,t,th(this,e,!0)),null==this.populateTransaction[t]&&Nr(this.populateTransaction,t,function(t,e){return function(...r){return Xa(t,e,r)}}(this,e)),null==this.estimateGas[t]&&Nr(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...i){return Ja(this,void 0,void 0,(function*(){r||Qa.throwError("estimate require a provider or signer",y.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const n=yield Xa(t,e,i);return yield r.estimateGas(n)}))}}(this,e))}})),Object.keys(i).forEach((t=>{const e=i[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&Nr(this,t,this[r])}catch(t){}null==this.functions[t]&&Nr(this.functions,t,this.functions[r]),null==this.callStatic[t]&&Nr(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&Nr(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&Nr(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return Oe(t)}static getInterface(t){return bn.isInterface(t)?t:new bn(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&Qa.throwError("contract not deployed",y.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||Qa.throwError("sending a transactions require a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=Rr(t||{});return["from","to"].forEach((function(t){null!=e[t]&&Qa.throwError("cannot override "+t,y.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new jn(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&Nr(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return yn.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new oh);if("event"===t)return this._normalizeRunningEvent(new nh("event",null));if("*"===t)return this._normalizeRunningEvent(new ah(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new sh(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new sh(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new nh(ih(e),e))}return this._normalizeRunningEvent(new ah(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const i=Or(e);return i.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},i.getBlock=()=>this.provider.getBlock(e.blockHash),i.getTransaction=()=>this.provider.getTransaction(e.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(i),i}_addEventListener(t,e,r){if(this.provider||Qa.throwError("events require a provider or a signer with a provider",y.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let i=this._wrapEvent(t,r,e);if(null==i.decodeError)try{const e=t.getEmit(i);this.emit(t.filter,...e)}catch(t){i.decodeError=t.error}null!=t.filter&&this.emit("event",i),null!=i.decodeError&&this.emit("error",i.decodeError,i)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const i=this._getRunningEvent(t),n=Rr(i.filter);return"string"==typeof e&&N(e,32)?(null!=r&&Qa.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),n.blockHash=e):(n.fromBlock=null!=e?e:0,n.toBlock=null!=r?r:"latest"),this.provider.getLogs(n).then((t=>t.map((t=>this._wrapEvent(i,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),i=r.run(e)>0;return this._checkRunningEvents(r),i}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}{}var uh=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(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,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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,a=0;if("be"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)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<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.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()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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],d=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(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,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(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},n.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},n.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?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;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()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.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},n.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)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,R=S>>>13,T=0|s[7],C=8191&T,P=T>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,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 _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(R,H)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,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 Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,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,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(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)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Rt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Rt,h[15]=Tt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(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 a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<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 n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}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()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.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 c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(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)},n.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},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.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(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(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},n.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},n.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},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<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},i(M,w),i(_,w),i(E,w),E.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},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.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)},A.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},A.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)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),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)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));let lh=!1,ch=!1;const fh={debug:1,default:2,info:2,warning:3,error:4,off:5};let dh=fh.default,mh=null;const ph=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 gh,yh;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(gh||(gh={})),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"}(yh||(yh={}));const vh="0123456789abcdef";class wh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==fh[r]&&this.throwArgumentError("invalid log level name","logLevel",t),dh>fh[r]||console.log.apply(console,e)}debug(...t){this._log(wh.levels.DEBUG,t)}info(...t){this._log(wh.levels.INFO,t)}warn(...t){this._log(wh.levels.WARNING,t)}makeError(t,e,r){if(ch)return this.makeError("censored error",e,{});e||(e=wh.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+=vh[e[t]>>4],r+=vh[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case yh.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case yh.CALL_EXCEPTION:case yh.INSUFFICIENT_FUNDS:case yh.MISSING_NEW:case yh.NONCE_EXPIRED:case yh.REPLACEMENT_UNDERPRICED:case yh.TRANSACTION_REPLACED:case yh.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,wh.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){ph&&this.throwError("platform missing String.prototype.normalize",wh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ph})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,wh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,wh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,wh.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,wh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",wh.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",wh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",wh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return mh||(mh=new wh("logger/5.7.0")),mh}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",wh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),lh){if(!t)return;this.globalLogger().throwError("error censorship permanent",wh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ch=!!t,lh=!!e}static setLogLevel(t){const e=fh[t.toLowerCase()];null!=e?dh=e:wh.globalLogger().warn("invalid log level - "+t)}static from(t){return new wh(t)}}wh.errors=yh,wh.levels=gh;const bh=new wh("bytes/5.7.0");function Mh(t){return!!t.toHexString}function _h(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return _h(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Eh(t){return"number"==typeof t&&t==t&&t%1==0}function Ah(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Eh(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Eh(r)||r<0||r>=256)return!1}return!0}function kh(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const xh="0123456789abcdef";function Nh(t,e){if(e||(e={}),"number"==typeof t){bh.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=xh[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),Mh(t))return t.toHexString();if(kh(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":bh.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ah(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=xh[(240&i)>>4]+xh[15&i]}return e}return bh.throwArgumentError("invalid hexlify value","value",t)}function Sh(t,e){for("string"!=typeof t?t=Nh(t):kh(t)||bh.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&bh.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const Ih="bignumber/5.7.0";var Rh=uh.BN;const Th=new wh(Ih),Ch={},Ph=9007199254740991;let Oh=!1;class Bh{constructor(t,e){t!==Ch&&Th.throwError("cannot call constructor directly; use BigNumber.from",wh.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Uh(Dh(this).fromTwos(t))}toTwos(t){return Uh(Dh(this).toTwos(t))}abs(){return"-"===this._hex[0]?Bh.from(this._hex.substring(1)):this}add(t){return Uh(Dh(this).add(Dh(t)))}sub(t){return Uh(Dh(this).sub(Dh(t)))}div(t){return Bh.from(t).isZero()&&Lh("division-by-zero","div"),Uh(Dh(this).div(Dh(t)))}mul(t){return Uh(Dh(this).mul(Dh(t)))}mod(t){const e=Dh(t);return e.isNeg()&&Lh("division-by-zero","mod"),Uh(Dh(this).umod(e))}pow(t){const e=Dh(t);return e.isNeg()&&Lh("negative-power","pow"),Uh(Dh(this).pow(e))}and(t){const e=Dh(t);return(this.isNegative()||e.isNeg())&&Lh("unbound-bitwise-result","and"),Uh(Dh(this).and(e))}or(t){const e=Dh(t);return(this.isNegative()||e.isNeg())&&Lh("unbound-bitwise-result","or"),Uh(Dh(this).or(e))}xor(t){const e=Dh(t);return(this.isNegative()||e.isNeg())&&Lh("unbound-bitwise-result","xor"),Uh(Dh(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Lh("negative-width","mask"),Uh(Dh(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Lh("negative-width","shl"),Uh(Dh(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Lh("negative-width","shr"),Uh(Dh(this).shrn(t))}eq(t){return Dh(this).eq(Dh(t))}lt(t){return Dh(this).lt(Dh(t))}lte(t){return Dh(this).lte(Dh(t))}gt(t){return Dh(this).gt(Dh(t))}gte(t){return Dh(this).gte(Dh(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Dh(this).isZero()}toNumber(){try{return Dh(this).toNumber()}catch(t){Lh("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Th.throwError("this platform does not support BigInt",wh.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Oh||(Oh=!0,Th.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Th.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",wh.errors.UNEXPECTED_ARGUMENT,{}):Th.throwError("BigNumber.toString does not accept parameters",wh.errors.UNEXPECTED_ARGUMENT,{})),Dh(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Bh)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Bh(Ch,$h(t)):t.match(/^-?[0-9]+$/)?new Bh(Ch,$h(new Rh(t))):Th.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Lh("underflow","BigNumber.from",t),(t>=Ph||t<=-Ph)&&Lh("overflow","BigNumber.from",t),Bh.from(String(t));const e=t;if("bigint"==typeof e)return Bh.from(e.toString());if(Ah(e))return Bh.from(Nh(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Bh.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(kh(t)||"-"===t[0]&&kh(t.substring(1))))return Bh.from(t)}return Th.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function $h(t){if("string"!=typeof t)return $h(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Th.throwArgumentError("invalid hex","value",t),"0x00"===(t=$h(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 Uh(t){return Bh.from($h(t))}function Dh(t){const e=Bh.from(t).toHexString();return"-"===e[0]?new Rh("-"+e.substring(3),16):new Rh(e.substring(2),16)}function Lh(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Th.throwError(t,wh.errors.NUMERIC_FAULT,i)}const Fh=new wh(Ih),jh={},zh=Bh.from(0),qh=Bh.from(-1);function Hh(t,e,r,i){const n={fault:e,operation:r};return void 0!==i&&(n.value=i),Fh.throwError(t,wh.errors.NUMERIC_FAULT,n)}let Vh="0";for(;Vh.length<256;)Vh+=Vh;function Zh(t){if("number"!=typeof t)try{t=Bh.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+Vh.substring(0,t):Fh.throwArgumentError("invalid decimal size","decimals",t)}function Gh(t,e){null==e&&(e=0);const r=Zh(e),i=(t=Bh.from(t)).lt(zh);i&&(t=t.mul(qh));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(r).toString();return t=1===r.length?o:o+"."+n,i&&(t="-"+t),t}function Kh(t,e){null==e&&(e=0);const r=Zh(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||Fh.throwArgumentError("invalid decimal value","value",t);const i="-"===t.substring(0,1);i&&(t=t.substring(1)),"."===t&&Fh.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&Fh.throwArgumentError("too many decimal points","value",t);let o=n[0],s=n[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Hh("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Bh.from(o),h=Bh.from(s);let u=a.mul(r).add(h);return i&&(u=u.mul(qh)),u}class Jh{constructor(t,e,r,i){t!==jh&&Fh.throwError("cannot use FixedFormat constructor; use FixedFormat.from",wh.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=i,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(i),this._multiplier=Zh(i),Object.freeze(this)}static from(t){if(t instanceof Jh)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,i=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const n=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);n||Fh.throwArgumentError("invalid fixed format","format",t),e="u"!==n[1],r=parseInt(n[2]),i=parseInt(n[3])}else if(t){const n=(e,r,i)=>null==t[e]?i:(typeof t[e]!==r&&Fh.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=n("signed","boolean",e),r=n("width","number",r),i=n("decimals","number",i)}return r%8&&Fh.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),i>80&&Fh.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new Jh(jh,e,r,i)}}class Qh{constructor(t,e,r,i){t!==jh&&Fh.throwError("cannot use FixedNumber constructor; use FixedNumber.from",wh.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Fh.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Kh(this._value,this.format.decimals),r=Kh(t._value,t.format.decimals);return Qh.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Qh.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(Wh.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Qh.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(Wh.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Fh.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=Qh.from("1"+Vh.substring(0,t),this.format),i=Yh.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&Fh.throwArgumentError("invalid byte width","width",t);return Sh(Bh.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return Qh.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(Bh.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||kh(t)||"bigint"==typeof t||Ah(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),Qh.fromString(Gh(t,e),Jh.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=Jh.from(e),i=Kh(t,r.decimals);!r.signed&&i.lt(zh)&&Hh("unsigned value cannot be negative","overflow","value",t);let n=null;r.signed?n=i.toTwos(r.width).toHexString():(n=i.toHexString(),n=Sh(n,r.width/8));const o=Gh(i,r.decimals);return new Qh(jh,n,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=Jh.from(e);if(function(t,e){if(e||(e={}),"number"==typeof t){bh.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),_h(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Mh(t)&&(t=t.toHexString()),kh(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":bh.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 _h(new Uint8Array(i))}return Ah(t)?_h(new Uint8Array(t)):bh.throwArgumentError("invalid arrayify value","value",t)}(t).length>r.width/8)throw new Error("overflow");let i=Bh.from(t);r.signed&&(i=i.fromTwos(r.width));const n=i.toTwos((r.signed?0:1)+r.width).toHexString(),o=Gh(i,r.decimals);return new Qh(jh,n,o,r)}static from(t,e){if("string"==typeof t)return Qh.fromString(t,e);if(Ah(t))return Qh.fromBytes(t,e);try{return Qh.fromValue(t,0,e)}catch(t){if(t.code!==wh.errors.INVALID_ARGUMENT)throw t}return Fh.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Wh=Qh.from(1),Yh=Qh.from("0.5");let Xh=!1,tu=!1;const eu={debug:1,default:2,info:2,warning:3,error:4,off:5};let ru=eu.default,iu=null;const nu=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 ou,su;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ou||(ou={})),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"}(su||(su={}));const au="0123456789abcdef";class hu{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==eu[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ru>eu[r]||console.log.apply(console,e)}debug(...t){this._log(hu.levels.DEBUG,t)}info(...t){this._log(hu.levels.INFO,t)}warn(...t){this._log(hu.levels.WARNING,t)}makeError(t,e,r){if(tu)return this.makeError("censored error",e,{});e||(e=hu.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+=au[e[t]>>4],r+=au[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case su.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case su.CALL_EXCEPTION:case su.INSUFFICIENT_FUNDS:case su.MISSING_NEW:case su.NONCE_EXPIRED:case su.REPLACEMENT_UNDERPRICED:case su.TRANSACTION_REPLACED:case su.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,hu.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){nu&&this.throwError("platform missing String.prototype.normalize",hu.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:nu})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,hu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,hu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,hu.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,hu.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",hu.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",hu.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",hu.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return iu||(iu=new hu("logger/5.7.0")),iu}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",hu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Xh){if(!t)return;this.globalLogger().throwError("error censorship permanent",hu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}tu=!!t,Xh=!!e}static setLogLevel(t){const e=eu[t.toLowerCase()];null!=e?ru=e:hu.globalLogger().warn("invalid log level - "+t)}static from(t){return new hu(t)}}hu.errors=su,hu.levels=ou;const uu=new hu("units/5.7.0"),lu=["wei","kwei","mwei","gwei","szabo","finney","ether"];let cu=!1,fu=!1;const du={debug:1,default:2,info:2,warning:3,error:4,off:5};let mu=du.default,pu=null;const gu=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 yu,vu;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(yu||(yu={})),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"}(vu||(vu={}));const wu="0123456789abcdef";class bu{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==du[r]&&this.throwArgumentError("invalid log level name","logLevel",t),mu>du[r]||console.log.apply(console,e)}debug(...t){this._log(bu.levels.DEBUG,t)}info(...t){this._log(bu.levels.INFO,t)}warn(...t){this._log(bu.levels.WARNING,t)}makeError(t,e,r){if(fu)return this.makeError("censored error",e,{});e||(e=bu.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+=wu[e[t]>>4],r+=wu[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case vu.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case vu.CALL_EXCEPTION:case vu.INSUFFICIENT_FUNDS:case vu.MISSING_NEW:case vu.NONCE_EXPIRED:case vu.REPLACEMENT_UNDERPRICED:case vu.TRANSACTION_REPLACED:case vu.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=n,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,bu.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){gu&&this.throwError("platform missing String.prototype.normalize",bu.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gu})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,bu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,bu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,bu.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,bu.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",bu.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",bu.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",bu.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return pu||(pu=new bu("logger/5.7.0")),pu}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",bu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),cu){if(!t)return;this.globalLogger().throwError("error censorship permanent",bu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fu=!!t,cu=!!e}static setLogLevel(t){const e=du[t.toLowerCase()];null!=e?mu=e:bu.globalLogger().warn("invalid log level - "+t)}static from(t){return new bu(t)}}bu.errors=vu,bu.levels=yu;const Mu=new bu("bytes/5.7.0");function _u(t){return!!t.toHexString}function Eu(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Eu(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Au(t){return"number"==typeof t&&t==t&&t%1==0}function ku(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Au(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Au(r)||r<0||r>=256)return!1}return!0}function xu(t,e){if(e||(e={}),"number"==typeof t){Mu.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),Eu(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),_u(t)&&(t=t.toHexString()),Su(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Mu.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 Eu(new Uint8Array(i))}return ku(t)?Eu(new Uint8Array(t)):Mu.throwArgumentError("invalid arrayify value","value",t)}function Nu(t){const e=t.map((t=>xu(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),Eu(i)}function Su(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Iu="0123456789abcdef";function Ru(t,e){if(e||(e={}),"number"==typeof t){Mu.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Iu[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),_u(t))return t.toHexString();if(Su(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Mu.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ku(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=Iu[(240&i)>>4]+Iu[15&i]}return e}return Mu.throwArgumentError("invalid hexlify value","value",t)}function Tu(t){let e="0x";return t.forEach((t=>{e+=Ru(t).substring(2)})),e}function Cu(t,e){for("string"!=typeof t?t=Ru(t):Su(t)||Mu.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Mu.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Pu(t){return"0x"+ve.keccak_256(xu(t))}const Ou=new bu("strings/5.7.0");var Bu,$u;function Uu(t,e,r,i,n){if(t===$u.BAD_PREFIX||t===$u.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===$u.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Bu||(Bu={})),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"}($u||($u={}));const Du=Object.freeze({error:function(t,e,r,i,n){return Ou.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Uu,replace:function(t,e,r,i,n){return t===$u.OVERLONG?(i.push(n),0):(i.push(65533),Uu(t,e,r))}});function Lu(t,e){null==e&&(e=Du.error),t=xu(t);const r=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,s=null;if(192==(224&n))o=1,s=127;else if(224==(240&n))o=2,s=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?$u.UNEXPECTED_CONTINUE:$u.BAD_PREFIX,i-1,t,r);continue}o=3,s=65535}if(i-1+o>=t.length){i+=e($u.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let n=0;n<o;n++){let n=t[i];if(128!=(192&n)){i+=e($u.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|63&n,i++}null!==a&&(a>1114111?i+=e($u.OUT_OF_RANGE,i-1-o,t,r,a):a>=55296&&a<=57343?i+=e($u.UTF16_SURROGATE,i-1-o,t,r,a):a<=s?i+=e($u.OVERLONG,i-1-o,t,r,a):r.push(a))}return r}function Fu(t,e=Bu.current){e!=Bu.current&&(Ou.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return xu(r)}function ju(t,e){return Lu(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function zu(t){return Pu(Fu(t))}const qu="hash/5.7.0";function Hu(t,e){null==e&&(e=1);const r=[],i=r.forEach,n=function(t,e){i.call(t,(function(t){e>0&&Array.isArray(t)?n(t,e-1):r.push(t)}))};return n(t,e),r}function Vu(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,o=[0,1];for(let t=1;t<i;t++)o.push(n+=r());let s=r(),a=e;e+=s;let h=0,u=0;function l(){return 0==h&&(u=u<<8|t[e++],h=8),u>>--h&1}const c=Math.pow(2,31),f=c>>>1,d=f>>1,m=c-1;let p=0;for(let t=0;t<31;t++)p=p<<1|l();let g=[],y=0,v=c;for(;;){let t=Math.floor(((p-y+1)*n-1)/v),e=0,r=i;for(;r-e>1;){let i=e+r>>>1;t<o[i]?r=i:e=i}if(0==e)break;g.push(e);let s=y+Math.floor(v*o[e]/n),a=y+Math.floor(v*o[e+1]/n)-1;for(;0==((s^a)&f);)p=p<<1&m|l(),s=s<<1&m,a=a<<1&m|1;for(;s&~a&d;)p=p&f|p<<1&m>>>1|l(),s=s<<1^f,a=(a^f)<<1|f|1;y=s,v=1+a-s}let w=i-4;return g.map((e=>{switch(e-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return e-1}}))}(t))}function Zu(t){return 1&t?~t>>1:t>>1}function Gu(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function Ku(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=Zu(e());return r}function Ju(t,e){let r=Gu(t(),t),i=t(),n=Gu(i,t),o=function(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}(i,t);for(let t=0;t<i;t++)for(let e=0;e<o[t];e++)r.push(n[t]+e);return e?r.map((t=>e[t])):r}function Qu(t,e,r){let i=Array(t).fill(void 0).map((()=>[]));for(let n=0;n<e;n++)Ku(t,r).forEach(((t,e)=>i[e].push(t)));return i}function Wu(t,e){let r=1+e(),i=e(),n=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return Hu(Qu(n.length,1+t,e).map(((t,e)=>{const o=t[0],s=t.slice(1);return Array(n[e]).fill(void 0).map(((t,e)=>{let n=e*i;return[o+e*r,s.map((t=>t+n))]}))})))}function Yu(t,e){return Qu(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Xu=Vu(function(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return xu(e)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),tl=new Set(Ju(Xu)),el=new Set(Ju(Xu)),rl=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(Wu(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Yu(r,t))}return function(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}(Hu(e))}(Xu),il=function(t){let e=Ju(t).sort(((t,e)=>t-e));return function r(){let i=[];for(;;){let n=Ju(t,e);if(0==n.length)break;i.push({set:new Set(n),node:r()})}i.sort(((t,e)=>e.set.size-t.set.size));let n=t(),o=n%3;n=n/3|0;let s=!!(1&n);return n>>=1,{branches:i,valid:o,fe0f:s,save:1==n,check:2==n}}()}(Xu);function nl(t){return function(t,e=Bu.current){return Lu(Fu(t,e))}(t)}function ol(t){return t.filter((t=>65039!=t))}function sl(t){for(let e of t.split(".")){let t=nl(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function al(t){return sl(function(t,e){let r=nl(t).reverse(),i=[];for(;r.length;){let t=hl(r);if(t){i.push(...e(t));continue}let n=r.pop();if(tl.has(n)){i.push(n);continue}if(el.has(n))continue;let o=rl[n];if(!o)throw new Error(`Disallowed codepoint: 0x${n.toString(16).toUpperCase()}`);i.push(...o)}return sl(function(t){return t.normalize("NFC")}(String.fromCodePoint(...i)))}(t,ol))}function hl(t,e){var r;let i,n,o=il,s=[],a=t.length;for(e&&(e.length=0);a;){let h=t[--a];if(o=null===(r=o.branches.find((t=>t.set.has(h))))||void 0===r?void 0:r.node,!o)break;if(o.save)n=h;else if(o.check&&h===n)break;s.push(h),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(i=s.slice(),2==o.valid&&i.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return i}const ul=new bu(qu),ll=new Uint8Array(32);function cl(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function fl(t){const e=Fu(al(t)),r=[];if(0===t.length)return r;let i=0;for(let t=0;t<e.length;t++){46===e[t]&&(r.push(cl(e.slice(i,t))),i=t+1)}if(i>=e.length)throw new Error("invalid ENS name; empty component");return r.push(cl(e.slice(i))),r}function dl(t){return fl(t).map((t=>ju(t))).join(".")}function ml(t){"string"!=typeof t&&ul.throwArgumentError("invalid ENS name; not a string","name",t);let e=ll;const r=fl(t);for(;r.length;)e=Pu(Nu([e,Pu(r.pop())]));return Ru(e)}ll.fill(0);const pl=new bu("address/5.7.0");function gl(t){Su(t,20)||pl.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=xu(Pu(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const yl={};for(let t=0;t<10;t++)yl[String(t)]=String(t);for(let t=0;t<26;t++)yl[String.fromCharCode(65+t)]=String(10+t);const vl=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function wl(t){let e=null;if("string"!=typeof t&&pl.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=gl(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&pl.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)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>yl[t])).join("");for(;e.length>=vl;){let t=e.substring(0,vl);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}(t)&&pl.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Rh(r,36).toString(16);e.length<40;)e="0"+e;e=gl("0x"+e)}else pl.throwArgumentError("invalid address","address",t);var r;return e}window&&window.__awaiter;const bl=new bu("properties/5.7.0");function Ml(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function _l(t){const e={};for(const r in t)e[r]=t[r];return e}const El={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Al(t){if(null==t||El[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch(t){continue}if(!Al(i))return!1}return!0}return bl.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function kl(t){if(Al(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>xl(t))));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&Ml(e,r,xl(i))}return e}return bl.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function xl(t){return kl(t)}var Nl=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Sl=new bu(qu),Il=new Uint8Array(32);Il.fill(0);const Rl=Bh.from(-1),Tl=Bh.from(0),Cl=Bh.from(1),Pl=Bh.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ol=Cu(Cl.toHexString(),32),Bl=Cu(Tl.toHexString(),32),$l={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ul=["name","version","chainId","verifyingContract","salt"];function Dl(t){return function(e){return"string"!=typeof e&&Sl.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Ll={name:Dl("name"),version:Dl("version"),chainId:function(t){try{return Bh.from(t).toString()}catch(t){}return Sl.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return wl(t).toLowerCase()}catch(t){}return Sl.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=xu(t);if(32!==e.length)throw new Error("bad length");return Ru(e)}catch(t){}return Sl.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Fl(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&Sl.throwArgumentError("invalid numeric width","type",t);const n=Pl.mask(r?i-1:i),o=r?n.add(Cl).mul(Rl):Tl;return function(e){const r=Bh.from(e);return(r.lt(o)||r.gt(n))&&Sl.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Cu(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Sl.throwArgumentError("invalid bytes width","type",t),function(e){return xu(e).length!==r&&Sl.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=xu(t),r=e.length%32;return r?Tu([e,Il.slice(r)]):Ru(e)}(e)}}}switch(t){case"address":return function(t){return Cu(wl(t),32)};case"bool":return function(t){return t?Ol:Bl};case"bytes":return function(t){return Pu(t)};case"string":return function(t){return zu(t)}}return null}function jl(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class zl{constructor(t){Ml(this,"types",Object.freeze(xl(t))),Ml(this,"_encoderCache",{}),Ml(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&Sl.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&Sl.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);Fl(s)||(r[s]||Sl.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(i),e[i][s]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?Sl.throwArgumentError("missing primary type","types",t):n.length>1&&Sl.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Ml(this,"primaryType",n[0]),function n(o,s){s[o]&&Sl.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,s),Object.keys(s).forEach((e=>{i[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=jl(e,t[e])+r.map((e=>jl(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Fl(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&Sl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(Pu)),Pu(Tu(n))}}const r=this.types[t];if(r){const e=zu(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?Pu(i):i}));return i.unshift(e),Tu(i)}}return Sl.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Sl.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Pu(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Fl(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&Sl.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):Sl.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new zl(t)}static getPrimaryType(t){return zl.from(t).primaryType}static hashStruct(t,e,r){return zl.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=$l[r];i||Sl.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>Ul.indexOf(t.name)-Ul.indexOf(e.name))),zl.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Tu(["0x1901",zl.hashDomain(t),zl.from(e).hash(r)])}static hash(t,e,r){return Pu(zl.encode(t,e,r))}static resolveNames(t,e,r,i){return Nl(this,void 0,void 0,(function*(){t=_l(t);const n={};t.verifyingContract&&!Su(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=zl.from(e);o.visit(r,((t,e)=>("address"!==t||Su(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){zl.hashDomain(t);const i={},n=[];Ul.forEach((e=>{const r=t[e];null!=r&&(i[e]=Ll[e](r),n.push({name:e,type:$l[e]}))}));const o=zl.from(e),s=_l(e);return s.EIP712Domain?Sl.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return Ru(xu(e));if(t.match(/^u?int/))return Bh.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Sl.throwArgumentError("invalid string","value",e),e}return Sl.throwArgumentError("unsupported type","type",t)}))}}}var ql=function(t){this.value=t},Hl=Object.defineProperty({EnumType:ql},"__esModule",{value:!0}),Vl=function(){function t(t){this.value=t}return t.prototype.toJSON=function(){return"$"+this.value},t}(),Zl=Object.defineProperty({VariableType:Vl},"__esModule",{value:!0}),Gl=o((function(t,e){function r(t){if(t instanceof Hl.EnumType)return t.value;if(t instanceof Zl.VariableType)return"$"+t.value;if("object"!=typeof t||null===t)return JSON.stringify(t);if(Array.isArray(t))return"["+t.map((function(t){return r(t)})).join(", ")+"]";var e=Object.keys(t).map((function(e){return e+": "+r(t[e])})).join(", ");return"{"+e+"}"}function i(t,r){return-1==e.configFields.indexOf(t)&&-1==r.indexOf(t)}function n(t,e,o,s){Object.keys(t).filter((function(t){return i(t,s.ignoreFields)})).forEach((function(a){var h=t[a];if("object"==typeof h){if(Array.isArray(h)&&!(h=h.find((function(t){return t&&"object"==typeof t}))))return void o.push([""+a,e]);var u=Object.keys(h).filter((function(t){return i(t,s.ignoreFields)})).length>0,l="object"==typeof h.__args&&Object.keys(h.__args).length>0,c="object"==typeof h.__directives,f=h.__all_on instanceof Array,d="object"==typeof h.__on,m=""+a;if("string"==typeof h.__name&&(m=m+" "+h.__name),"string"==typeof h.__aliasFor&&(m=m+": "+h.__aliasFor),"object"==typeof h.__variables&&Object.keys(h.__variables).length>0)m=m+" ("+function(t){var e=[];for(var r in t)e.push("$"+r+": "+t[r]);return e.join(", ")}(h.__variables)+")";else if(l||c){var p="",g="";c&&(g=Object.entries(h.__directives).map((function(t){var e;return"@"+function(t){var e=Object.keys(t)[0],i=t[e];if("boolean"==typeof i||"object"==typeof i&&0===Object.keys(i).length)return e;if("object"==typeof i){var n=[];for(var o in i){var s=r(i[o]).replace(/"/g,"");n.push(o+": "+s)}return e+"("+n.join(", ")+")"}throw new Error("Unsupported type for directive: "+typeof i+". Types allowed: object, boolean.\nOffending object: "+JSON.stringify(t))}(((e={})[t[0]]=t[1],e))})).join(" ")),l&&(p="("+function(t){var e=[];for(var i in t)e.push(i+": "+r(t[i]));return e.join(", ")}(h.__args)+")"),m=m+" "+p+(c&&l?" ":"")+g}if(o.push([m+(u||d||f?" {":""),e]),n(h,e+1,o,s),f&&h.__all_on.forEach((function(t){o.push(["..."+t,e+1])})),d)(h.__on instanceof Array?h.__on:[h.__on]).forEach((function(t){var r=t.__typeName;o.push(["... on "+r+" {",e+1]),n(t,e+2,o,s),o.push(["}",e+1])}));(u||d||f)&&o.push(["}",e])}else(!0===s.includeFalsyKeys||h)&&o.push([""+a,e])}))}Object.defineProperty(e,"__esModule",{value:!0}),e.configFields=["__args","__alias","__aliasFor","__variables","__directives","__on","__all_on","__typeName","__name"],e.jsonToGraphQLQuery=function(t,e){if(void 0===e&&(e={}),!t||"object"!=typeof t)throw new Error("query object not specified");if(0==Object.keys(t).length)throw new Error("query object has no data");e.ignoreFields instanceof Array||(e.ignoreFields=[]);var r=[];n(t,0,r,e);var i="";return r.forEach((function(t){var r=t[0],n=t[1];e.pretty?(i&&(i+="\n"),i+=function(t){return Array(4*t+1).join(" ")}(n)+r):(i&&(i+=" "),i+=r)})),i}})),Kl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(Gl),e.EnumType=Hl.EnumType,e.VariableType=Zl.VariableType})),Jl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class r{}e._CodeOrName=r,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends r{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=i;class n extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const t=this._items[0];return""===t||'""'===t}get str(){var t;return null!==(t=this._str)&&void 0!==t?t:this._str=this._items.reduce(((t,e)=>`${t}${e}`),"")}get names(){var t;return null!==(t=this._names)&&void 0!==t?t:this._names=this._items.reduce(((t,e)=>(e instanceof i&&(t[e.str]=(t[e.str]||0)+1),t)),{})}}function o(t,...e){const r=[t[0]];let i=0;for(;i<e.length;)h(r,e[i]),r.push(t[++i]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(t,...e){const r=[l(t[0])];let i=0;for(;i<e.length;)r.push(s),h(r,e[i]),r.push(s,l(t[++i]));return function(t){let e=1;for(;e<t.length-1;){if(t[e]===s){const r=u(t[e-1],t[e+1]);if(void 0!==r){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}(r),new n(r)}function h(t,e){e instanceof n?t.push(...e._items):e instanceof i?t.push(e):t.push(function(t){return"number"==typeof t||"boolean"==typeof t||null===t?t:l(Array.isArray(t)?t.join(","):t)}(e))}function u(t,e){if('""'===e)return t;if('""'===t)return e;if("string"==typeof t){if(e instanceof i||'"'!==t[t.length-1])return;return"string"!=typeof e?`${t.slice(0,-1)}${e}"`:'"'===e[0]?t.slice(0,-1)+e.slice(1):void 0}return"string"!=typeof e||'"'!==e[0]||t instanceof i?void 0:`"${t}${e.slice(1)}`}function l(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=h,e.strConcat=function(t,e){return e.emptyStr()?t:t.emptyStr()?e:a`${t}${e}`},e.stringify=function(t){return new n(l(t))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(t){return new n(t.toString())}})),Ql=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;class r extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}}var i;!function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"}(i=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new Jl.Name("const"),let:new Jl.Name("let"),var:new Jl.Name("var")};class n{constructor({prefixes:t,parent:e}={}){this._names={},this._prefixes=t,this._parent=e}toName(t){return t instanceof Jl.Name?t:this.name(t)}name(t){return new Jl.Name(this._newName(t))}_newName(t){return`${t}${(this._names[t]||this._nameGroup(t)).index++}`}_nameGroup(t){var e,r;if((null===(r=null===(e=this._parent)||void 0===e?void 0:e._prefixes)||void 0===r?void 0:r.has(t))||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}}e.Scope=n;class o extends Jl.Name{constructor(t,e){super(e),this.prefix=t}setValue(t,{property:e,itemIndex:r}){this.value=t,this.scopePath=Jl._`.${new Jl.Name(e)}[${r}]`}}e.ValueScopeName=o;const s=Jl._`\n`;e.ValueScope=class extends n{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?s:Jl.nil}}get(){return this._scope}name(t){return new o(t,this._newName(t))}value(t,e){var r;if(void 0===e.ref)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(t),{prefix:n}=i,o=null!==(r=e.key)&&void 0!==r?r:e.ref;let s=this._values[n];if(s){const t=s.get(o);if(t)return t}else s=this._values[n]=new Map;s.set(o,i);const a=this._scope[n]||(this._scope[n]=[]),h=a.length;return a[h]=e.ref,i.setValue(e,{property:n,itemIndex:h}),i}getValue(t,e){const r=this._values[t];if(r)return r.get(e)}scopeRefs(t,e=this._values){return this._reduceValues(e,(e=>{if(void 0===e.scopePath)throw new Error(`CodeGen: name "${e}" has no value`);return Jl._`${t}${e.scopePath}`}))}scopeCode(t=this._values,e,r){return this._reduceValues(t,(t=>{if(void 0===t.value)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),e,r)}_reduceValues(t,n,o={},s){let a=Jl.nil;for(const h in t){const u=t[h];if(!u)continue;const l=o[h]=o[h]||new Map;u.forEach((t=>{if(l.has(t))return;l.set(t,i.Started);let o=n(t);if(o){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;a=Jl._`${a}${r} ${t} = ${o};${this.opts._n}`}else{if(!(o=null==s?void 0:s(t)))throw new r(t);a=Jl._`${a}${o}${this.opts._n}`}l.set(t,i.Completed)}))}return a}}})),Wl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var r=Jl;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=Ql;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new Jl._Code(">"),GTE:new Jl._Code(">="),LT:new Jl._Code("<"),LTE:new Jl._Code("<="),EQ:new Jl._Code("==="),NEQ:new Jl._Code("!=="),NOT:new Jl._Code("!"),OR:new Jl._Code("||"),AND:new Jl._Code("&&"),ADD:new Jl._Code("+")};class n{optimizeNodes(){return this}optimizeNames(t,e){return this}}class o extends n{constructor(t,e,r){super(),this.varKind=t,this.name=e,this.rhs=r}render({es5:t,_n:e}){const r=t?Ql.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${i};`+e}optimizeNames(t,e){if(t[this.name.str])return this.rhs&&(this.rhs=S(this.rhs,t,e)),this}get names(){return this.rhs instanceof Jl._CodeOrName?this.rhs.names:{}}}class s extends n{constructor(t,e,r){super(),this.lhs=t,this.rhs=e,this.sideEffects=r}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,e){if(!(this.lhs instanceof Jl.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=S(this.rhs,t,e),this}get names(){return N(this.lhs instanceof Jl.Name?{}:{...this.lhs.names},this.rhs)}}class a extends s{constructor(t,e,r,i){super(t,r,i),this.op=e}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class h extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}}class u extends n{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}}class l extends n{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class c extends n{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,e){return this.code=S(this.code,t,e),this}get names(){return this.code instanceof Jl._CodeOrName?this.code.names:{}}}class f extends n{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce(((e,r)=>e+r.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let e=t.length;for(;e--;){const r=t[e].optimizeNodes();Array.isArray(r)?t.splice(e,1,...r):r?t[e]=r:t.splice(e,1)}return t.length>0?this:void 0}optimizeNames(t,e){const{nodes:r}=this;let i=r.length;for(;i--;){const n=r[i];n.optimizeNames(t,e)||(I(t,n.names),r.splice(i,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((t,e)=>x(t,e.names)),{})}}class d extends f{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class m extends f{}class p extends d{}p.kind="else";class g extends d{constructor(t,e){super(e),this.condition=t}render(t){let e=`if(${this.condition})`+super.render(t);return this.else&&(e+="else "+this.else.render(t)),e}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(!0===t)return this.nodes;let e=this.else;if(e){const t=e.optimizeNodes();e=this.else=Array.isArray(t)?new p(t):t}return e?!1===t?e instanceof g?e:e.nodes:this.nodes.length?this:new g(R(t),e instanceof g?[e]:e.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(t,e){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(t,e),super.optimizeNames(t,e)||this.else)return this.condition=S(this.condition,t,e),this}get names(){const t=super.names;return N(t,this.condition),this.else&&x(t,this.else.names),t}}g.kind="if";class y extends d{}y.kind="for";class v extends y{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iteration=S(this.iteration,t,e),this}get names(){return x(super.names,this.iteration.names)}}class w extends y{constructor(t,e,r,i){super(),this.varKind=t,this.name=e,this.from=r,this.to=i}render(t){const e=t.es5?Ql.varKinds.var:this.varKind,{name:r,from:i,to:n}=this;return`for(${e} ${r}=${i}; ${r}<${n}; ${r}++)`+super.render(t)}get names(){const t=N(super.names,this.from);return N(t,this.to)}}class b extends y{constructor(t,e,r,i){super(),this.loop=t,this.varKind=e,this.name=r,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iterable=S(this.iterable,t,e),this}get names(){return x(super.names,this.iterable.names)}}class M extends d{constructor(t,e,r){super(),this.name=t,this.args=e,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}M.kind="func";class _ extends f{render(t){return"return "+super.render(t)}}_.kind="return";class E extends d{render(t){let e="try"+super.render(t);return this.catch&&(e+=this.catch.render(t)),this.finally&&(e+=this.finally.render(t)),e}optimizeNodes(){var t,e;return super.optimizeNodes(),null===(t=this.catch)||void 0===t||t.optimizeNodes(),null===(e=this.finally)||void 0===e||e.optimizeNodes(),this}optimizeNames(t,e){var r,i;return super.optimizeNames(t,e),null===(r=this.catch)||void 0===r||r.optimizeNames(t,e),null===(i=this.finally)||void 0===i||i.optimizeNames(t,e),this}get names(){const t=super.names;return this.catch&&x(t,this.catch.names),this.finally&&x(t,this.finally.names),t}}class A extends d{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}A.kind="catch";class k extends d{render(t){return"finally"+super.render(t)}}k.kind="finally";function x(t,e){for(const r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function N(t,e){return e instanceof Jl._CodeOrName?x(t,e.names):t}function S(t,e,r){return t instanceof Jl.Name?n(t):(i=t)instanceof Jl._Code&&i._items.some((t=>t instanceof Jl.Name&&1===e[t.str]&&void 0!==r[t.str]))?new Jl._Code(t._items.reduce(((t,e)=>(e instanceof Jl.Name&&(e=n(e)),e instanceof Jl._Code?t.push(...e._items):t.push(e),t)),[])):t;var i;function n(t){const i=r[t.str];return void 0===i||1!==e[t.str]?t:(delete e[t.str],i)}}function I(t,e){for(const r in e)t[r]=(t[r]||0)-(e[r]||0)}function R(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:Jl._`!${O(t)}`}e.CodeGen=class{constructor(t,e={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...e,_n:e.lines?"\n":""},this._extScope=t,this._scope=new Ql.Scope({parent:t}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,e){const r=this._extScope.value(t,e);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(t,e){return this._extScope.getValue(t,e)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,e,r,i){const n=this._scope.toName(e);return void 0!==r&&i&&(this._constants[n.str]=r),this._leafNode(new o(t,n,r)),n}const(t,e,r){return this._def(Ql.varKinds.const,t,e,r)}let(t,e,r){return this._def(Ql.varKinds.let,t,e,r)}var(t,e,r){return this._def(Ql.varKinds.var,t,e,r)}assign(t,e,r){return this._leafNode(new s(t,e,r))}add(t,r){return this._leafNode(new a(t,e.operators.ADD,r))}code(t){return"function"==typeof t?t():t!==Jl.nil&&this._leafNode(new c(t)),this}object(...t){const e=["{"];for(const[r,i]of t)e.length>1&&e.push(","),e.push(r),(r!==i||this.opts.es5)&&(e.push(":"),(0,Jl.addCodeArg)(e,i));return e.push("}"),new Jl._Code(e)}if(t,e,r){if(this._blockNode(new g(t)),e&&r)this.code(e).else().code(r).endIf();else if(e)this.code(e).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new g(t))}else(){return this._elseNode(new p)}endIf(){return this._endBlockNode(g,p)}_for(t,e){return this._blockNode(t),e&&this.code(e).endFor(),this}for(t,e){return this._for(new v(t),e)}forRange(t,e,r,i,n=(this.opts.es5?Ql.varKinds.var:Ql.varKinds.let)){const o=this._scope.toName(t);return this._for(new w(n,o,e,r),(()=>i(o)))}forOf(t,e,r,i=Ql.varKinds.const){const n=this._scope.toName(t);if(this.opts.es5){const t=e instanceof Jl.Name?e:this.var("_arr",e);return this.forRange("_i",0,Jl._`${t}.length`,(e=>{this.var(n,Jl._`${t}[${e}]`),r(n)}))}return this._for(new b("of",i,n,e),(()=>r(n)))}forIn(t,e,r,i=(this.opts.es5?Ql.varKinds.var:Ql.varKinds.const)){if(this.opts.ownProperties)return this.forOf(t,Jl._`Object.keys(${e})`,r);const n=this._scope.toName(t);return this._for(new b("in",i,n,e),(()=>r(n)))}endFor(){return this._endBlockNode(y)}label(t){return this._leafNode(new h(t))}break(t){return this._leafNode(new u(t))}return(t){const e=new _;if(this._blockNode(e),this.code(t),1!==e.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(t,e,r){if(!e&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new E;if(this._blockNode(i),this.code(t),e){const t=this.name("e");this._currNode=i.catch=new A(t),e(t)}return r&&(this._currNode=i.finally=new k,this.code(r)),this._endBlockNode(A,k)}throw(t){return this._leafNode(new l(t))}block(t,e){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(e),this}endBlock(t){const e=this._blockStarts.pop();if(void 0===e)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-e;if(r<0||void 0!==t&&r!==t)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${t} expected`);return this._nodes.length=e,this}func(t,e=Jl.nil,r,i){return this._blockNode(new M(t,e,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(M)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,e){const r=this._currNode;if(r instanceof t||e&&r instanceof e)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${e?`${t.kind}/${e.kind}`:t.kind}"`)}_elseNode(t){const e=this._currNode;if(!(e instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=e.else=t,this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const e=this._nodes;e[e.length-1]=t}},e.not=R;const T=P(e.operators.AND);e.and=function(...t){return t.reduce(T)};const C=P(e.operators.OR);function P(t){return(e,r)=>e===Jl.nil?r:r===Jl.nil?e:Jl._`${O(e)} ${t} ${O(r)}`}function O(t){return t instanceof Jl.Name?t:Jl._`(${t})`}e.or=function(...t){return t.reduce(C)}})),Yl=o((function(t,e){function r(t,e=t.schema){const{opts:r,self:i}=t;if(!r.strictSchema)return;if("boolean"==typeof e)return;const n=i.RULES.keywords;for(const r in e)n[r]||c(t,`unknown keyword: "${r}"`)}function i(t,e){if("boolean"==typeof t)return!t;for(const r in t)if(e[r])return!0;return!1}function n(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function o(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{const h=void 0===s?o:s instanceof Wl.Name?(o instanceof Wl.Name?t(n,o,s):e(n,o,s),s):o instanceof Wl.Name?(e(n,s,o),o):r(o,s);return a!==Wl.Name||h instanceof Wl.Name?h:i(n,h)}}function a(t,e){if(!0===e)return t.var("props",!0);const r=t.var("props",Wl._`{}`);return void 0!==e&&h(t,r,e),r}function h(t,e,r){Object.keys(r).forEach((r=>t.assign(Wl._`${e}${(0,Wl.getProperty)(r)}`,!0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0,e.toHash=function(t){const e={};for(const r of t)e[r]=!0;return e},e.alwaysValidSchema=function(t,e){return"boolean"==typeof e?e:0===Object.keys(e).length||(r(t,e),!i(e,t.self.RULES.all))},e.checkUnknownRules=r,e.schemaHasRules=i,e.schemaHasRulesButRef=function(t,e){if("boolean"==typeof t)return!t;for(const r in t)if("$ref"!==r&&e.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:t,schemaPath:e},r,i,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return Wl._`${r}`}return Wl._`${t}${e}${(0,Wl.getProperty)(i)}`},e.unescapeFragment=function(t){return o(decodeURIComponent(t))},e.escapeFragment=function(t){return encodeURIComponent(n(t))},e.escapeJsonPointer=n,e.unescapeJsonPointer=o,e.eachItem=function(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)},e.mergeEvaluated={props:s({mergeNames:(t,e,r)=>t.if(Wl._`${r} !== true && ${e} !== undefined`,(()=>{t.if(Wl._`${e} === true`,(()=>t.assign(r,!0)),(()=>t.assign(r,Wl._`${r} || {}`).code(Wl._`Object.assign(${r}, ${e})`)))})),mergeToName:(t,e,r)=>t.if(Wl._`${r} !== true`,(()=>{!0===e?t.assign(r,!0):(t.assign(r,Wl._`${r} || {}`),h(t,r,e))})),mergeValues:(t,e)=>!0===t||{...t,...e},resultToName:a}),items:s({mergeNames:(t,e,r)=>t.if(Wl._`${r} !== true && ${e} !== undefined`,(()=>t.assign(r,Wl._`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`))),mergeToName:(t,e,r)=>t.if(Wl._`${r} !== true`,(()=>t.assign(r,!0===e||Wl._`${r} > ${e} ? ${r} : ${e}`))),mergeValues:(t,e)=>!0===t||Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})},e.evaluatedPropsToName=a,e.setEvaluated=h;const u={};var l;function c(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,!0===r)throw new Error(e);t.self.logger.warn(e)}}e.useFunc=function(t,e){return t.scopeValue("func",{ref:e,code:u[e.code]||(u[e.code]=new Jl._Code(e.code))})},function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"}(l=e.Type||(e.Type={})),e.getErrorPath=function(t,e,r){if(t instanceof Wl.Name){const i=e===l.Num;return r?i?Wl._`"[" + ${t} + "]"`:Wl._`"['" + ${t} + "']"`:i?Wl._`"/" + ${t}`:Wl._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Wl.getProperty)(t).toString():"/"+n(t)},e.checkStrictMode=c}));var Xl={data:new Wl.Name("data"),valCxt:new Wl.Name("valCxt"),instancePath:new Wl.Name("instancePath"),parentData:new Wl.Name("parentData"),parentDataProperty:new Wl.Name("parentDataProperty"),rootData:new Wl.Name("rootData"),dynamicAnchors:new Wl.Name("dynamicAnchors"),vErrors:new Wl.Name("vErrors"),errors:new Wl.Name("errors"),this:new Wl.Name("this"),self:new Wl.Name("self"),scope:new Wl.Name("scope"),json:new Wl.Name("json"),jsonPos:new Wl.Name("jsonPos"),jsonLen:new Wl.Name("jsonLen"),jsonPart:new Wl.Name("jsonPart")},tc=Object.defineProperty({default:Xl},"__esModule",{value:!0}),ec=o((function(t,e){function r(t,e){const r=t.const("err",e);t.if(Wl._`${tc.default.vErrors} === null`,(()=>t.assign(tc.default.vErrors,Wl._`[${r}]`)),Wl._`${tc.default.vErrors}.push(${r})`),t.code(Wl._`${tc.default.errors}++`)}function i(t,e){const{gen:r,validateName:i,schemaEnv:n}=t;n.$async?r.throw(Wl._`new ${t.ValidationError}(${e})`):(r.assign(Wl._`${i}.errors`,e),r.return(!1))}Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0,e.keywordError={message:({keyword:t})=>Wl.str`must pass "${t}" keyword validation`},e.keyword$DataError={message:({keyword:t,schemaType:e})=>e?Wl.str`"${t}" keyword must be ${e} ($data)`:Wl.str`"${t}" keyword is invalid ($data)`},e.reportError=function(t,n=e.keywordError,s,a){const{it:h}=t,{gen:u,compositeRule:l,allErrors:c}=h,f=o(t,n,s);(null!=a?a:l||c)?r(u,f):i(h,Wl._`[${f}]`)},e.reportExtraError=function(t,n=e.keywordError,s){const{it:a}=t,{gen:h,compositeRule:u,allErrors:l}=a;r(h,o(t,n,s)),u||l||i(a,tc.default.vErrors)},e.resetErrorsCount=function(t,e){t.assign(tc.default.errors,e),t.if(Wl._`${tc.default.vErrors} !== null`,(()=>t.if(e,(()=>t.assign(Wl._`${tc.default.vErrors}.length`,e)),(()=>t.assign(tc.default.vErrors,null)))))},e.extendErrors=function({gen:t,keyword:e,schemaValue:r,data:i,errsCount:n,it:o}){if(void 0===n)throw new Error("ajv implementation error");const s=t.name("err");t.forRange("i",n,tc.default.errors,(n=>{t.const(s,Wl._`${tc.default.vErrors}[${n}]`),t.if(Wl._`${s}.instancePath === undefined`,(()=>t.assign(Wl._`${s}.instancePath`,(0,Wl.strConcat)(tc.default.instancePath,o.errorPath)))),t.assign(Wl._`${s}.schemaPath`,Wl.str`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign(Wl._`${s}.schema`,r),t.assign(Wl._`${s}.data`,i))}))};const n={keyword:new Wl.Name("keyword"),schemaPath:new Wl.Name("schemaPath"),params:new Wl.Name("params"),propertyName:new Wl.Name("propertyName"),message:new Wl.Name("message"),schema:new Wl.Name("schema"),parentSchema:new Wl.Name("parentSchema")};function o(t,e,r){const{createErrors:i}=t.it;return!1===i?Wl._`{}`:function(t,e,r={}){const{gen:i,it:o}=t,h=[s(o,r),a(t,r)];return function(t,{params:e,message:r},i){const{keyword:o,data:s,schemaValue:a,it:h}=t,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:f}=h;i.push([n.keyword,o],[n.params,"function"==typeof e?e(t):e||Wl._`{}`]),u.messages&&i.push([n.message,"function"==typeof r?r(t):r]);u.verbose&&i.push([n.schema,a],[n.parentSchema,Wl._`${c}${f}`],[tc.default.data,s]);l&&i.push([n.propertyName,l])}(t,e,h),i.object(...h)}(t,e,r)}function s({errorPath:t},{instancePath:e}){const r=e?Wl.str`${t}${(0,Yl.getErrorPath)(e,Yl.Type.Str)}`:t;return[tc.default.instancePath,(0,Wl.strConcat)(tc.default.instancePath,r)]}function a({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:i}){let o=i?e:Wl.str`${e}/${t}`;return r&&(o=Wl.str`${o}${(0,Yl.getErrorPath)(r,Yl.Type.Str)}`),[n.schemaPath,o]}})),rc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;const r={message:"boolean schema is false"};function i(t,e){const{gen:i,data:n}=t,o={gen:i,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ec.reportError)(o,r,void 0,e)}e.topBoolOrEmptySchema=function(t){const{gen:e,schema:r,validateName:n}=t;!1===r?i(t,!1):"object"==typeof r&&!0===r.$async?e.return(tc.default.data):(e.assign(Wl._`${n}.errors`,null),e.return(!0))},e.boolOrEmptySchema=function(t,e){const{gen:r,schema:n}=t;!1===n?(r.var(e,!1),i(t)):r.var(e,!0)}})),ic=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(t){return"string"==typeof t&&r.has(t)},e.getRules=function(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}})),nc=o((function(t,e){function r(t,e){return e.rules.some((e=>i(t,e)))}function i(t,e){var r;return void 0!==t[e.keyword]||(null===(r=e.definition.implements)||void 0===r?void 0:r.some((e=>void 0!==t[e])))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:t,self:e},i){const n=e.RULES.types[i];return n&&!0!==n&&r(t,n)},e.shouldUseGroup=r,e.shouldUseRule=i})),oc=o((function(t,e){var r;function i(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(ic.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0,function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"}(r=e.DataType||(e.DataType={})),e.getSchemaTypes=function(t){const e=i(t.type);if(e.includes("null")){if(!1===t.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&void 0!==t.nullable)throw new Error('"nullable" cannot be used without "type"');!0===t.nullable&&e.push("null")}return e},e.getJSONTypes=i,e.coerceAndCheckDataType=function(t,e){const{gen:i,data:o,opts:a}=t,u=function(t,e){return e?t.filter((t=>n.has(t)||"array"===e&&"array"===t)):[]}(e,a.coerceTypes),l=e.length>0&&!(0===u.length&&1===e.length&&(0,nc.schemaHasRulesForType)(t,e[0]));if(l){const l=s(e,o,a.strictNumbers,r.Wrong);i.if(l,(()=>{u.length?function(t,e,r){const{gen:i,data:o,opts:a}=t,u=i.let("dataType",Wl._`typeof ${o}`),l=i.let("coerced",Wl._`undefined`);"array"===a.coerceTypes&&i.if(Wl._`${u} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>i.assign(o,Wl._`${o}[0]`).assign(u,Wl._`typeof ${o}`).if(s(e,o,a.strictNumbers),(()=>i.assign(l,o)))));i.if(Wl._`${l} !== undefined`);for(const t of r)(n.has(t)||"array"===t&&"array"===a.coerceTypes)&&c(t);function c(t){switch(t){case"string":return void i.elseIf(Wl._`${u} == "number" || ${u} == "boolean"`).assign(l,Wl._`"" + ${o}`).elseIf(Wl._`${o} === null`).assign(l,Wl._`""`);case"number":return void i.elseIf(Wl._`${u} == "boolean" || ${o} === null
|
|
16
16
|
|| (${u} == "string" && ${o} && ${o} == +${o})`).assign(l,Wl._`+${o}`);case"integer":return void i.elseIf(Wl._`${u} === "boolean" || ${o} === null
|
|
17
17
|
|| (${u} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(l,Wl._`+${o}`);case"boolean":return void i.elseIf(Wl._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(l,!1).elseIf(Wl._`${o} === "true" || ${o} === 1`).assign(l,!0);case"null":return i.elseIf(Wl._`${o} === "" || ${o} === 0 || ${o} === false`),void i.assign(l,null);case"array":i.elseIf(Wl._`${u} === "string" || ${u} === "number"
|
|
18
18
|
|| ${u} === "boolean" || ${o} === null`).assign(l,Wl._`[${o}]`)}}i.else(),h(t),i.endIf(),i.if(Wl._`${l} !== undefined`,(()=>{i.assign(o,l),function({gen:t,parentData:e,parentDataProperty:r},i){t.if(Wl._`${e} !== undefined`,(()=>t.assign(Wl._`${e}[${r}]`,i)))}(t,l)}))}(t,e,u):h(t)}))}return l};const n=new Set(["string","number","integer","boolean","null"]);function o(t,e,i,n=r.Correct){const o=n===r.Correct?Wl.operators.EQ:Wl.operators.NEQ;let s;switch(t){case"null":return Wl._`${e} ${o} null`;case"array":s=Wl._`Array.isArray(${e})`;break;case"object":s=Wl._`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=a(Wl._`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=a();break;default:return Wl._`typeof ${e} ${o} ${t}`}return n===r.Correct?s:(0,Wl.not)(s);function a(t=Wl.nil){return(0,Wl.and)(Wl._`typeof ${e} == "number"`,t,i?Wl._`isFinite(${e})`:Wl.nil)}}function s(t,e,r,i){if(1===t.length)return o(t[0],e,r,i);let n;const s=(0,Yl.toHash)(t);if(s.array&&s.object){const t=Wl._`typeof ${e} != "object"`;n=s.null?t:Wl._`!${e} || ${t}`,delete s.null,delete s.array,delete s.object}else n=Wl.nil;s.number&&delete s.integer;for(const t in s)n=(0,Wl.and)(n,o(t,e,r,i));return n}e.checkDataType=o,e.checkDataTypes=s;const a={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>"string"==typeof t?Wl._`{type: ${t}}`:Wl._`{type: ${e}}`};function h(t){const e=function(t){const{gen:e,data:r,schema:i}=t,n=(0,Yl.schemaRefOrVal)(t,i,"type");return{gen:e,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}(t);(0,ec.reportError)(e,a)}e.reportTypeError=h})),sc=o((function(t,e){function r(t,e,r){const{gen:i,compositeRule:n,data:o,opts:s}=t;if(void 0===r)return;const a=Wl._`${o}${(0,Wl.getProperty)(e)}`;if(n)return void(0,Yl.checkStrictMode)(t,`default is ignored for: ${a}`);let h=Wl._`${a} === undefined`;"empty"===s.useDefaults&&(h=Wl._`${h} || ${a} === null || ${a} === ""`),i.if(h,Wl._`${a} = ${(0,Wl.stringify)(r)}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0,e.assignDefaults=function(t,e){const{properties:i,items:n}=t.schema;if("object"===e&&i)for(const e in i)r(t,e,i[e].default);else"array"===e&&Array.isArray(n)&&n.forEach(((e,i)=>r(t,i,e.default)))}})),ac=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;const r=Yl;function i(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Wl._`Object.prototype.hasOwnProperty`})}function n(t,e,r){return Wl._`${i(t)}.call(${e}, ${r})`}function o(t,e,r,i){const o=Wl._`${e}${(0,Wl.getProperty)(r)} === undefined`;return i?(0,Wl.or)(o,(0,Wl.not)(n(t,e,r))):o}function s(t){return t?Object.keys(t).filter((t=>"__proto__"!==t)):[]}e.checkReportMissingProp=function(t,e){const{gen:r,data:i,it:n}=t;r.if(o(r,i,e,n.opts.ownProperties),(()=>{t.setParams({missingProperty:Wl._`${e}`},!0),t.error()}))},e.checkMissingProp=function({gen:t,data:e,it:{opts:r}},i,n){return(0,Wl.or)(...i.map((i=>(0,Wl.and)(o(t,e,i,r.ownProperties),Wl._`${n} = ${i}`))))},e.reportMissingProp=function(t,e){t.setParams({missingProperty:e},!0),t.error()},e.hasPropFunc=i,e.isOwnProperty=n,e.propertyInData=function(t,e,r,i){const o=Wl._`${e}${(0,Wl.getProperty)(r)} !== undefined`;return i?Wl._`${o} && ${n(t,e,r)}`:o},e.noPropertyInData=o,e.allSchemaProperties=s,e.schemaProperties=function(t,e){return s(e).filter((r=>!(0,Yl.alwaysValidSchema)(t,e[r])))},e.callValidateCode=function({schemaCode:t,data:e,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,h,u){const l=u?Wl._`${t}, ${e}, ${i}${n}`:e,c=[[tc.default.instancePath,(0,Wl.strConcat)(tc.default.instancePath,o)],[tc.default.parentData,s.parentData],[tc.default.parentDataProperty,s.parentDataProperty],[tc.default.rootData,tc.default.rootData]];s.opts.dynamicRef&&c.push([tc.default.dynamicAnchors,tc.default.dynamicAnchors]);const f=Wl._`${l}, ${r.object(...c)}`;return h!==Wl.nil?Wl._`${a}.call(${h}, ${f})`:Wl._`${a}(${f})`};const a=Wl._`new RegExp`;e.usePattern=function({gen:t,it:{opts:e}},i){const n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(i,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:Wl._`${"new RegExp"===o.code?a:(0,r.useFunc)(t,o)}(${i}, ${n})`})},e.validateArray=function(t){const{gen:e,data:r,keyword:i,it:n}=t,o=e.name("valid");if(n.allErrors){const t=e.let("valid",!0);return s((()=>e.assign(t,!1))),t}return e.var(o,!0),s((()=>e.break())),o;function s(n){const s=e.const("len",Wl._`${r}.length`);e.forRange("i",0,s,(r=>{t.subschema({keyword:i,dataProp:r,dataPropType:Yl.Type.Num},o),e.if((0,Wl.not)(o),n)}))}},e.validateUnion=function(t){const{gen:e,schema:r,keyword:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((t=>(0,Yl.alwaysValidSchema)(n,t)))&&!n.opts.unevaluated)return;const o=e.let("valid",!1),s=e.name("_valid");e.block((()=>r.forEach(((r,n)=>{const a=t.subschema({keyword:i,schemaProp:n,compositeRule:!0},s);e.assign(o,Wl._`${o} || ${s}`);t.mergeValidEvaluated(a,s)||e.if((0,Wl.not)(o))})))),t.result(o,(()=>t.reset()),(()=>t.error(!0)))}})),hc=o((function(t,e){function r(t){const{gen:e,data:r,it:i}=t;e.if(i.parentData,(()=>e.assign(r,Wl._`${i.parentData}[${i.parentDataProperty}]`)))}function i(t,e,r){if(void 0===r)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,Wl.stringify)(r)})}Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0,e.macroKeywordCode=function(t,e){const{gen:r,keyword:n,schema:o,parentSchema:s,it:a}=t,h=e.macro.call(a.self,o,s,a),u=i(r,n,h);!1!==a.opts.validateSchema&&a.self.validateSchema(h,!0);const l=r.name("valid");t.subschema({schema:h,schemaPath:Wl.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,(()=>t.error(!0)))},e.funcKeywordCode=function(t,e){var n;const{gen:o,keyword:s,schema:a,parentSchema:h,$data:u,it:l}=t;!function({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}(l,e);const c=!u&&e.compile?e.compile.call(l.self,a,h,l):e.validate,f=i(o,s,c),d=o.let("valid");function m(r=(e.async?Wl._`await `:Wl.nil)){const i=l.opts.passContext?tc.default.this:tc.default.self,n=!("compile"in e&&!u||!1===e.schema);o.assign(d,Wl._`${r}${(0,ac.callValidateCode)(t,f,i,n)}`,e.modifying)}function p(t){var r;o.if((0,Wl.not)(null!==(r=e.valid)&&void 0!==r?r:d),t)}t.block$data(d,(function(){if(!1===e.errors)m(),e.modifying&&r(t),p((()=>t.error()));else{const i=e.async?function(){const t=o.let("ruleErrs",null);return o.try((()=>m(Wl._`await `)),(e=>o.assign(d,!1).if(Wl._`${e} instanceof ${l.ValidationError}`,(()=>o.assign(t,Wl._`${e}.errors`)),(()=>o.throw(e))))),t}():function(){const t=Wl._`${f}.errors`;return o.assign(t,null),m(Wl.nil),t}();e.modifying&&r(t),p((()=>function(t,e){const{gen:r}=t;r.if(Wl._`Array.isArray(${e})`,(()=>{r.assign(tc.default.vErrors,Wl._`${tc.default.vErrors} === null ? ${e} : ${tc.default.vErrors}.concat(${e})`).assign(tc.default.errors,Wl._`${tc.default.vErrors}.length`),(0,ec.extendErrors)(t)}),(()=>t.error()))}(t,i)))}})),t.ok(null!==(n=e.valid)&&void 0!==n?n:d)},e.validSchemaType=function(t,e,r=!1){return!e.length||e.some((e=>"array"===e?Array.isArray(t):"object"===e?t&&"object"==typeof t&&!Array.isArray(t):typeof t==e||r&&void 0===t))},e.validateKeywordUsage=function({schema:t,opts:e,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const s=n.dependencies;if(null==s?void 0:s.some((e=>!Object.prototype.hasOwnProperty.call(t,e))))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(t[o])){const t=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if("log"!==e.validateSchema)throw new Error(t);r.logger.error(t)}}}})),uc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0,e.getSubschema=function(t,{keyword:e,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(void 0!==e&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==e){const i=t.schema[e];return void 0===r?{schema:i,schemaPath:Wl._`${t.schemaPath}${(0,Wl.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[r],schemaPath:Wl._`${t.schemaPath}${(0,Wl.getProperty)(e)}${(0,Wl.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Yl.escapeFragment)(r)}`}}if(void 0!==i){if(void 0===n||void 0===o||void 0===s)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(t,e,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(void 0!==n&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=e;if(void 0!==r){const{errorPath:n,dataPathArr:o,opts:s}=e;h(a.let("data",Wl._`${e.data}${(0,Wl.getProperty)(r)}`,!0)),t.errorPath=Wl.str`${n}${(0,Yl.getErrorPath)(r,i,s.jsPropertySyntax)}`,t.parentDataProperty=Wl._`${r}`,t.dataPathArr=[...o,t.parentDataProperty]}if(void 0!==n){h(n instanceof Wl.Name?n:a.let("data",n,!0)),void 0!==s&&(t.propertyName=s)}function h(r){t.data=r,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,r]}o&&(t.dataTypes=o)},e.extendSubschemaMode=function(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){void 0!==i&&(t.compositeRule=i),void 0!==n&&(t.createErrors=n),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}})),lc=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if((i=e.length)!=r.length)return!1;for(n=i;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((i=(o=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;0!=n--;){var s=o[n];if(!t(e[s],r[s]))return!1}return!0}return e!=e&&r!=r},cc=o((function(t){var e=t.exports=function(t,e,i){"function"==typeof e&&(i=e,e={}),r(e,"function"==typeof(i=e.cb||i)?i:i.pre||function(){},i.post||function(){},t,"",t)};function r(t,i,n,o,s,a,h,u,l,c){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var f in i(o,s,a,h,u,l,c),o){var d=o[f];if(Array.isArray(d)){if(f in e.arrayKeywords)for(var m=0;m<d.length;m++)r(t,i,n,d[m],s+"/"+f+"/"+m,a,s,f,o,m)}else if(f in e.propsKeywords){if(d&&"object"==typeof d)for(var p in d)r(t,i,n,d[p],s+"/"+f+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1"),a,s,f,o,p)}else(f in e.keywords||t.allKeys&&!(f in e.skipKeywords))&&r(t,i,n,d,s+"/"+f,a,s,f,o)}n(o,s,a,h,u,l,c)}}e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}})),fc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;const r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(t,e=!0){return"boolean"==typeof t||(!0===e?!n(t):!!e&&o(t)<=e)};const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function n(t){for(const e in t){if(i.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(n))return!0;if("object"==typeof r&&n(r))return!0}return!1}function o(t){let e=0;for(const i in t){if("$ref"===i)return 1/0;if(e++,!r.has(i)&&("object"==typeof t[i]&&(0,Yl.eachItem)(t[i],(t=>e+=o(t))),e===1/0))return 1/0}return e}function s(t,e="",r){!1!==r&&(e=u(e));const i=t.parse(e);return a(t,i)}function a(t,e){return t.serialize(e).split("#")[0]+"#"}e.getFullPath=s,e._getFullPath=a;const h=/#\/?$/;function u(t){return t?t.replace(h,""):""}e.normalizeId=u,e.resolveUrl=function(t,e,r){return r=u(r),t.resolve(e,r)};const l=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(t,e){if("boolean"==typeof t)return{};const{schemaId:r,uriResolver:i}=this.opts,n=u(t[r]||e),o={"":n},a=s(i,n,!1),h={},c=new Set;return cc(t,{allKeys:!0},((t,e,i,n)=>{if(void 0===n)return;const s=a+e;let m=o[n];function p(e){const r=this.opts.uriResolver.resolve;if(e=u(m?r(m,e):e),c.has(e))throw d(e);c.add(e);let i=this.refs[e];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?f(t,i.schema,e):e!==u(s)&&("#"===e[0]?(f(t,h[e],e),h[e]=t):this.refs[e]=s),e}function g(t){if("string"==typeof t){if(!l.test(t))throw new Error(`invalid anchor "${t}"`);p.call(this,`#${t}`)}}"string"==typeof t[r]&&(m=p.call(this,t[r])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),o[e]=m})),h;function f(t,e,r){if(void 0!==e&&!lc(t,e))throw d(r)}function d(t){return new Error(`reference "${t}" resolves to more than one schema`)}}})),dc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;const r=oc;function i({gen:t,validateName:e,schema:r,schemaEnv:i,opts:o},s){o.code.es5?t.func(e,Wl._`${tc.default.data}, ${tc.default.valCxt}`,i.$async,(()=>{t.code(Wl._`"use strict"; ${n(r,o)}`),function(t,e){t.if(tc.default.valCxt,(()=>{t.var(tc.default.instancePath,Wl._`${tc.default.valCxt}.${tc.default.instancePath}`),t.var(tc.default.parentData,Wl._`${tc.default.valCxt}.${tc.default.parentData}`),t.var(tc.default.parentDataProperty,Wl._`${tc.default.valCxt}.${tc.default.parentDataProperty}`),t.var(tc.default.rootData,Wl._`${tc.default.valCxt}.${tc.default.rootData}`),e.dynamicRef&&t.var(tc.default.dynamicAnchors,Wl._`${tc.default.valCxt}.${tc.default.dynamicAnchors}`)}),(()=>{t.var(tc.default.instancePath,Wl._`""`),t.var(tc.default.parentData,Wl._`undefined`),t.var(tc.default.parentDataProperty,Wl._`undefined`),t.var(tc.default.rootData,tc.default.data),e.dynamicRef&&t.var(tc.default.dynamicAnchors,Wl._`{}`)}))}(t,o),t.code(s)})):t.func(e,Wl._`${tc.default.data}, ${function(t){return Wl._`{${tc.default.instancePath}="", ${tc.default.parentData}, ${tc.default.parentDataProperty}, ${tc.default.rootData}=${tc.default.data}${t.dynamicRef?Wl._`, ${tc.default.dynamicAnchors}={}`:Wl.nil}}={}`}(o)}`,i.$async,(()=>t.code(n(r,o)).code(s)))}function n(t,e){const r="object"==typeof t&&t[e.schemaId];return r&&(e.code.source||e.code.process)?Wl._`/*# sourceURL=${r} */`:Wl.nil}function o(t,e){a(t)&&(h(t),s(t))?function(t,e){const{schema:r,gen:i,opts:n}=t;n.$comment&&r.$comment&&l(t);(function(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,fc.resolveUrl)(t.opts.uriResolver,t.baseId,e))})(t),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}(t);const o=i.const("_errs",tc.default.errors);u(t,o),i.var(e,Wl._`${o} === ${tc.default.errors}`)}(t,e):(0,rc.boolOrEmptySchema)(t,e)}function s({schema:t,self:e}){if("boolean"==typeof t)return!t;for(const r in t)if(e.RULES.all[r])return!0;return!1}function a(t){return"boolean"!=typeof t.schema}function h(t){(0,Yl.checkUnknownRules)(t),function(t){const{schema:e,errSchemaPath:r,opts:i,self:n}=t;e.$ref&&i.ignoreKeywordsWithRef&&(0,Yl.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(t)}function u(t,e){if(t.opts.jtd)return c(t,[],!1,e);const r=(0,oc.getSchemaTypes)(t.schema);c(t,r,!(0,oc.coerceAndCheckDataType)(t,r),e)}function l({gen:t,schemaEnv:e,schema:r,errSchemaPath:i,opts:n}){const o=r.$comment;if(!0===n.$comment)t.code(Wl._`${tc.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=Wl.str`${i}/$comment`,n=t.scopeValue("root",{ref:e.root});t.code(Wl._`${tc.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function c(t,e,i,n){const{gen:o,schema:s,data:a,allErrors:h,opts:u,self:l}=t,{RULES:c}=l;function g(l){(0,nc.shouldUseGroup)(s,l)&&(l.type?(o.if((0,r.checkDataType)(l.type,a,u.strictNumbers)),f(t,l),1===e.length&&e[0]===l.type&&i&&(o.else(),(0,r.reportTypeError)(t)),o.endIf()):f(t,l),h||o.if(Wl._`${tc.default.errors} === ${n||0}`))}!s.$ref||!u.ignoreKeywordsWithRef&&(0,Yl.schemaHasRulesButRef)(s,c)?(u.jtd||function(t,e){if(t.schemaEnv.meta||!t.opts.strictTypes)return;(function(t,e){if(!e.length)return;if(!t.dataTypes.length)return void(t.dataTypes=e);e.forEach((e=>{m(t.dataTypes,e)||p(t,`type "${e}" not allowed by context "${t.dataTypes.join(",")}"`)})),t.dataTypes=t.dataTypes.filter((t=>m(e,t)))})(t,e),t.opts.allowUnionTypes||function(t,e){e.length>1&&(2!==e.length||!e.includes("null"))&&p(t,"use allowUnionTypes to allow union type keyword")}(t,e);!function(t,e){const r=t.self.RULES.all;for(const i in r){const n=r[i];if("object"==typeof n&&(0,nc.shouldUseRule)(t.schema,n)){const{type:r}=n.definition;r.length&&!r.some((t=>d(e,t)))&&p(t,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(t,t.dataTypes)}(t,e),o.block((()=>{for(const t of c.rules)g(t);g(c.post)}))):o.block((()=>y(t,"$ref",c.all.$ref.definition)))}function f(t,e){const{gen:r,schema:i,opts:{useDefaults:n}}=t;n&&(0,sc.assignDefaults)(t,e.type),r.block((()=>{for(const r of e.rules)(0,nc.shouldUseRule)(i,r)&&y(t,r.keyword,r.definition,e.type)}))}function d(t,e){return t.includes(e)||"number"===e&&t.includes("integer")}function m(t,e){return t.includes(e)||"integer"===e&&t.includes("number")}function p(t,e){e+=` at "${t.schemaEnv.baseId+t.errSchemaPath}" (strictTypes)`,(0,Yl.checkStrictMode)(t,e,t.opts.strictTypes)}e.validateFunctionCode=function(t){a(t)&&(h(t),s(t))?function(t){const{schema:e,opts:r,gen:n}=t;i(t,(()=>{r.$comment&&e.$comment&&l(t),function(t){const{schema:e,opts:r}=t;void 0!==e.default&&r.useDefaults&&r.strictSchema&&(0,Yl.checkStrictMode)(t,"default is ignored in the schema root")}(t),n.let(tc.default.vErrors,null),n.let(tc.default.errors,0),r.unevaluated&&function(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",Wl._`${r}.evaluated`),e.if(Wl._`${t.evaluated}.dynamicProps`,(()=>e.assign(Wl._`${t.evaluated}.props`,Wl._`undefined`))),e.if(Wl._`${t.evaluated}.dynamicItems`,(()=>e.assign(Wl._`${t.evaluated}.items`,Wl._`undefined`)))}(t),u(t),function(t){const{gen:e,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=t;r.$async?e.if(Wl._`${tc.default.errors} === 0`,(()=>e.return(tc.default.data)),(()=>e.throw(Wl._`new ${n}(${tc.default.vErrors})`))):(e.assign(Wl._`${i}.errors`,tc.default.vErrors),o.unevaluated&&function({gen:t,evaluated:e,props:r,items:i}){r instanceof Wl.Name&&t.assign(Wl._`${e}.props`,r);i instanceof Wl.Name&&t.assign(Wl._`${e}.items`,i)}(t),e.return(Wl._`${tc.default.errors} === 0`))}(t)}))}(t):i(t,(()=>(0,rc.topBoolOrEmptySchema)(t)))};class g{constructor(t,e,r){if((0,hc.validateKeywordUsage)(t,e,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=e.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Yl.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=e.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=e,this.$data)this.schemaCode=t.gen.const("vSchema",b(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,hc.validSchemaType)(this.schema,e.schemaType,e.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(e.schemaType)}`);("code"in e?e.trackErrors:!1!==e.errors)&&(this.errsCount=t.gen.const("_errs",tc.default.errors))}result(t,e,r){this.failResult((0,Wl.not)(t),e,r)}failResult(t,e,r){this.gen.if(t),r?r():this.error(),e?(this.gen.else(),e(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,e){this.failResult((0,Wl.not)(t),void 0,e)}fail(t){if(void 0===t)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:e}=this;this.fail(Wl._`${e} !== undefined && (${(0,Wl.or)(this.invalid$data(),t)})`)}error(t,e,r){if(e)return this.setParams(e),this._error(t,r),void this.setParams({});this._error(t,r)}_error(t,e){(t?ec.reportExtraError:ec.reportError)(this,this.def.error,e)}$dataError(){(0,ec.reportError)(this,this.def.$dataError||ec.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,ec.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,e){e?Object.assign(this.params,t):this.params=t}block$data(t,e,r=Wl.nil){this.gen.block((()=>{this.check$data(t,r),e()}))}check$data(t=Wl.nil,e=Wl.nil){if(!this.$data)return;const{gen:r,schemaCode:i,schemaType:n,def:o}=this;r.if((0,Wl.or)(Wl._`${i} === undefined`,e)),t!==Wl.nil&&r.assign(t,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==Wl.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:e,schemaType:i,def:n,it:o}=this;return(0,Wl.or)(function(){if(i.length){if(!(e instanceof Wl.Name))throw new Error("ajv implementation error");const t=Array.isArray(i)?i:[i];return Wl._`${(0,r.checkDataTypes)(t,e,o.opts.strictNumbers,r.DataType.Wrong)}`}return Wl.nil}(),function(){if(n.validateSchema){const r=t.scopeValue("validate$data",{ref:n.validateSchema});return Wl._`!${r}(${e})`}return Wl.nil}())}subschema(t,e){const r=(0,uc.getSubschema)(this.it,t);(0,uc.extendSubschemaData)(r,this.it,t),(0,uc.extendSubschemaMode)(r,t);const i={...this.it,...r,items:void 0,props:void 0};return o(i,e),i}mergeEvaluated(t,e){const{it:r,gen:i}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==t.props&&(r.props=Yl.mergeEvaluated.props(i,t.props,r.props,e)),!0!==r.items&&void 0!==t.items&&(r.items=Yl.mergeEvaluated.items(i,t.items,r.items,e)))}mergeValidEvaluated(t,e){const{it:r,gen:i}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return i.if(e,(()=>this.mergeEvaluated(t,Wl.Name))),!0}}function y(t,e,r,i){const n=new g(t,r,e);"code"in r?r.code(n,i):n.$data&&r.validate?(0,hc.funcKeywordCode)(n,r):"macro"in r?(0,hc.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,hc.funcKeywordCode)(n,r)}e.KeywordCxt=g;const v=/^\/(?:[^~]|~0|~1)*$/,w=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function b(t,{dataLevel:e,dataNames:r,dataPathArr:i}){let n,o;if(""===t)return tc.default.rootData;if("/"===t[0]){if(!v.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=tc.default.rootData}else{const s=w.exec(t);if(!s)throw new Error(`Invalid JSON-pointer: ${t}`);const a=+s[1];if(n=s[2],"#"===n){if(a>=e)throw new Error(h("property/index",a));return i[e-a]}if(a>e)throw new Error(h("data",a));if(o=r[e-a],!n)return o}let s=o;const a=n.split("/");for(const t of a)t&&(o=Wl._`${o}${(0,Wl.getProperty)((0,Yl.unescapeJsonPointer)(t))}`,s=Wl._`${s} && ${o}`);return s;function h(t,r){return`Cannot access ${t} ${r} levels up, current level is ${e}`}}e.getData=b}));class mc extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}var pc=mc,gc=Object.defineProperty({default:pc},"__esModule",{value:!0});class yc extends Error{constructor(t,e,r,i){super(i||`can't resolve reference ${r} from id ${e}`),this.missingRef=(0,fc.resolveUrl)(t,e,r),this.missingSchema=(0,fc.normalizeId)((0,fc.getFullPath)(t,this.missingRef))}}var vc=yc,wc=Object.defineProperty({default:vc},"__esModule",{value:!0}),bc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;class r{constructor(t){var e;let r;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(e=t.baseId)&&void 0!==e?e:(0,fc.normalizeId)(null==r?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(t){const e=o.call(this,t);if(e)return e;const r=(0,fc.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:s}=this.opts,a=new Wl.CodeGen(this.scope,{es5:i,lines:n,ownProperties:s});let h;t.$async&&(h=a.scopeValue("Error",{ref:gc.default,code:Wl._`require("ajv/dist/runtime/validation_error").default`}));const u=a.scopeName("validate");t.validateName=u;const l={gen:a,allErrors:this.opts.allErrors,data:tc.default.data,parentData:tc.default.parentData,parentDataProperty:tc.default.parentDataProperty,dataNames:[tc.default.data],dataPathArr:[Wl.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,Wl.stringify)(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:h,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Wl.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:Wl._`""`,opts:this.opts,self:this};let c;try{this._compilations.add(t),(0,dc.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);const e=a.toString();c=`${a.scopeRefs(tc.default.scope)}return ${e}`,this.opts.code.process&&(c=this.opts.code.process(c,t));const r=new Function(`${tc.default.self}`,`${tc.default.scope}`,c)(this,this.scope.get());if(this.scope.value(u,{ref:r}),r.errors=null,r.schema=t.schema,r.schemaEnv=t,t.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:u,validateCode:e,scopeValues:a._values}),this.opts.unevaluated){const{props:t,items:e}=l;r.evaluated={props:t instanceof Wl.Name?void 0:t,items:e instanceof Wl.Name?void 0:e,dynamicProps:t instanceof Wl.Name,dynamicItems:e instanceof Wl.Name},r.source&&(r.source.evaluated=(0,Wl.stringify)(r.evaluated))}return t.validate=r,t}catch(e){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),e}finally{this._compilations.delete(t)}}function n(t){return(0,fc.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:i.call(this,t)}function o(t){for(const i of this._compilations)if(r=t,(e=i).schema===r.schema&&e.root===r.root&&e.baseId===r.baseId)return i;var e,r}function s(t,e){let r;for(;"string"==typeof(r=this.refs[e]);)e=r;return r||this.schemas[e]||a.call(this,t,e)}function a(t,e){const n=this.opts.uriResolver.parse(e),o=(0,fc._getFullPath)(this.opts.uriResolver,n);let s=(0,fc.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===s)return u.call(this,n,t);const h=(0,fc.normalizeId)(o),l=this.refs[h]||this.schemas[h];if("string"==typeof l){const e=a.call(this,t,l);if("object"!=typeof(null==e?void 0:e.schema))return;return u.call(this,n,e)}if("object"==typeof(null==l?void 0:l.schema)){if(l.validate||i.call(this,l),h===(0,fc.normalizeId)(e)){const{schema:e}=l,{schemaId:i}=this.opts,n=e[i];return n&&(s=(0,fc.resolveUrl)(this.opts.uriResolver,s,n)),new r({schema:e,schemaId:i,root:t,baseId:s})}return u.call(this,n,l)}}e.SchemaEnv=r,e.compileSchema=i,e.resolveRef=function(t,e,i){var o;i=(0,fc.resolveUrl)(this.opts.uriResolver,e,i);const a=t.refs[i];if(a)return a;let h=s.call(this,t,i);if(void 0===h){const n=null===(o=t.localRefs)||void 0===o?void 0:o[i],{schemaId:s}=this.opts;n&&(h=new r({schema:n,schemaId:s,root:t,baseId:e}))}return void 0!==h?t.refs[i]=n.call(this,h):void 0},e.getCompilingSchema=o,e.resolveSchema=a;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function u(t,{baseId:e,schema:i,root:n}){var o;if("/"!==(null===(o=t.fragment)||void 0===o?void 0:o[0]))return;for(const r of t.fragment.slice(1).split("/")){if("boolean"==typeof i)return;const t=i[(0,Yl.unescapeFragment)(r)];if(void 0===t)return;const n="object"==typeof(i=t)&&i[this.opts.schemaId];!h.has(r)&&n&&(e=(0,fc.resolveUrl)(this.opts.uriResolver,e,n))}let s;if("boolean"!=typeof i&&i.$ref&&!(0,Yl.schemaHasRulesButRef)(i,this.RULES)){const t=(0,fc.resolveUrl)(this.opts.uriResolver,e,i.$ref);s=a.call(this,n,t)}const{schemaId:u}=this.opts;return s=s||new r({schema:i,schemaId:u,root:n,baseId:e}),s.schema!==s.root.schema?s:void 0}})),Mc={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},_c=o((function(t,e){!function(t){function e(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length>1){e[0]=e[0].slice(0,-1);for(var i=e.length-1,n=1;n<i;++n)e[n]=e[n].slice(1,-1);return e[i]=e[i].slice(1),e.join("")}return e[0]}function r(t){return"(?:"+t+")"}function i(t){return void 0===t?"undefined":null===t?"null":Object.prototype.toString.call(t).split(" ").pop().split("]").shift().toLowerCase()}function n(t){return t.toUpperCase()}function o(t){return null!=t?t instanceof Array?t:"number"!=typeof t.length||t.split||t.setInterval||t.call?[t]:Array.prototype.slice.call(t):[]}function s(t,e){var r=t;if(e)for(var i in e)r[i]=e[i];return r}function a(t){var i="[A-Za-z]",n="[0-9]",o=e(n,"[A-Fa-f]"),s=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",h=e("[\\:\\/\\?\\#\\[\\]\\@]",a),u=t?"[\\uE000-\\uF8FF]":"[]",l=e(i,n,"[\\-\\.\\_\\~]",t?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),c=(r(i+e(i,n,"[\\+\\-\\.]")+"*"),r(r(s+"|"+e(l,a,"[\\:]"))+"*"),r(r("25[0-5]")+"|"+r("2[0-4]"+n)+"|"+r("1"+n+n)+"|"+r("0?[1-9]"+n)+"|0?0?"+n)),f=r(c+"\\."+c+"\\."+c+"\\."+c),d=r(o+"{1,4}"),m=r(r(d+"\\:"+d)+"|"+f),p=r(r(d+"\\:")+"{6}"+m),g=r("\\:\\:"+r(d+"\\:")+"{5}"+m),y=r(r(d)+"?\\:\\:"+r(d+"\\:")+"{4}"+m),v=r(r(r(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+r(d+"\\:")+"{3}"+m),w=r(r(r(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+r(d+"\\:")+"{2}"+m),b=r(r(r(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+m),M=r(r(r(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+m),_=r(r(r(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),E=r(r(r(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),A=r([p,g,y,v,w,b,M,_,E].join("|")),k=r(r(l+"|"+s)+"+"),x=(r("[vV]"+o+"+\\."+e(l,a,"[\\:]")+"+"),r(r(s+"|"+e(l,a))+"*"),r(s+"|"+e(l,a,"[\\:\\@]")));return r(r(s+"|"+e(l,a,"[\\@]"))+"+"),r(r(x+"|"+e("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(e("[^]",i,n,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",l,h),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+A+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+k+")")+"?\\]?$")}}var h=a(!1),u=a(!0),l=function(){function t(t,e){var r=[],i=!0,n=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);i=!0);}catch(t){n=!0,o=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},f=2147483647,d=36,m=1,p=26,g=38,y=700,v=72,w=128,b="-",M=/^xn--/,_=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=d-m,x=Math.floor,N=String.fromCharCode;function S(t){throw new RangeError(A[t])}function I(t,e){for(var r=[],i=t.length;i--;)r[i]=e(t[i]);return r}function R(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+I((t=t.replace(E,".")).split("."),e).join(".")}function T(t){for(var e=[],r=0,i=t.length;r<i;){var n=t.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){var o=t.charCodeAt(r++);56320==(64512&o)?e.push(((1023&n)<<10)+(1023&o)+65536):(e.push(n),r--)}else e.push(n)}return e}var C=function(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:d},P=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},O=function(t,e,r){var i=0;for(t=r?x(t/y):t>>1,t+=x(t/e);t>k*p>>1;i+=d)t=x(t/k);return x(i+(k+1)*t/(t+g))},B=function(t){var e=[],r=t.length,i=0,n=w,o=v,s=t.lastIndexOf(b);s<0&&(s=0);for(var a=0;a<s;++a)t.charCodeAt(a)>=128&&S("not-basic"),e.push(t.charCodeAt(a));for(var h=s>0?s+1:0;h<r;){for(var u=i,l=1,c=d;;c+=d){h>=r&&S("invalid-input");var g=C(t.charCodeAt(h++));(g>=d||g>x((f-i)/l))&&S("overflow"),i+=g*l;var y=c<=o?m:c>=o+p?p:c-o;if(g<y)break;var M=d-y;l>x(f/M)&&S("overflow"),l*=M}var _=e.length+1;o=O(i-u,_,0==u),x(i/_)>f-n&&S("overflow"),n+=x(i/_),i%=_,e.splice(i++,0,n)}return String.fromCodePoint.apply(String,e)},$=function(t){var e=[],r=(t=T(t)).length,i=w,n=0,o=v,s=!0,a=!1,h=void 0;try{for(var u,l=t[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c=u.value;c<128&&e.push(N(c))}}catch(t){a=!0,h=t}finally{try{!s&&l.return&&l.return()}finally{if(a)throw h}}var g=e.length,y=g;for(g&&e.push(b);y<r;){var M=f,_=!0,E=!1,A=void 0;try{for(var k,I=t[Symbol.iterator]();!(_=(k=I.next()).done);_=!0){var R=k.value;R>=i&&R<M&&(M=R)}}catch(t){E=!0,A=t}finally{try{!_&&I.return&&I.return()}finally{if(E)throw A}}var C=y+1;M-i>x((f-n)/C)&&S("overflow"),n+=(M-i)*C,i=M;var B=!0,$=!1,U=void 0;try{for(var D,L=t[Symbol.iterator]();!(B=(D=L.next()).done);B=!0){var F=D.value;if(F<i&&++n>f&&S("overflow"),F==i){for(var j=n,z=d;;z+=d){var q=z<=o?m:z>=o+p?p:z-o;if(j<q)break;var H=j-q,V=d-q;e.push(N(P(q+H%V,0))),j=x(H/V)}e.push(N(P(j,0))),o=O(n,C,y==g),n=0,++y}}}catch(t){$=!0,U=t}finally{try{!B&&L.return&&L.return()}finally{if($)throw U}}++n,++i}return e.join("")},U=function(t){return R(t,(function(t){return M.test(t)?B(t.slice(4).toLowerCase()):t}))},D=function(t){return R(t,(function(t){return _.test(t)?"xn--"+$(t):t}))},L={version:"2.1.0",ucs2:{decode:T,encode:function(t){return String.fromCodePoint.apply(String,c(t))}},decode:B,encode:$,toASCII:D,toUnicode:U},F={};function j(t){var e=t.charCodeAt(0);return e<16?"%0"+e.toString(16).toUpperCase():e<128?"%"+e.toString(16).toUpperCase():e<2048?"%"+(e>>6|192).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase():"%"+(e>>12|224).toString(16).toUpperCase()+"%"+(e>>6&63|128).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase()}function z(t){for(var e="",r=0,i=t.length;r<i;){var n=parseInt(t.substr(r+1,2),16);if(n<128)e+=String.fromCharCode(n),r+=3;else if(n>=194&&n<224){if(i-r>=6){var o=parseInt(t.substr(r+4,2),16);e+=String.fromCharCode((31&n)<<6|63&o)}else e+=t.substr(r,6);r+=6}else if(n>=224){if(i-r>=9){var s=parseInt(t.substr(r+4,2),16),a=parseInt(t.substr(r+7,2),16);e+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&a)}else e+=t.substr(r,9);r+=9}else e+=t.substr(r,3),r+=3}return e}function q(t,e){function r(t){var r=z(t);return r.match(e.UNRESERVED)?r:t}return t.scheme&&(t.scheme=String(t.scheme).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_SCHEME,"")),void 0!==t.userinfo&&(t.userinfo=String(t.userinfo).replace(e.PCT_ENCODED,r).replace(e.NOT_USERINFO,j).replace(e.PCT_ENCODED,n)),void 0!==t.host&&(t.host=String(t.host).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_HOST,j).replace(e.PCT_ENCODED,n)),void 0!==t.path&&(t.path=String(t.path).replace(e.PCT_ENCODED,r).replace(t.scheme?e.NOT_PATH:e.NOT_PATH_NOSCHEME,j).replace(e.PCT_ENCODED,n)),void 0!==t.query&&(t.query=String(t.query).replace(e.PCT_ENCODED,r).replace(e.NOT_QUERY,j).replace(e.PCT_ENCODED,n)),void 0!==t.fragment&&(t.fragment=String(t.fragment).replace(e.PCT_ENCODED,r).replace(e.NOT_FRAGMENT,j).replace(e.PCT_ENCODED,n)),t}function H(t){return t.replace(/^0*(.*)/,"$1")||"0"}function V(t,e){var r=t.match(e.IPV4ADDRESS)||[],i=l(r,2)[1];return i?i.split(".").map(H).join("."):t}function Z(t,e){var r=t.match(e.IPV6ADDRESS)||[],i=l(r,3),n=i[1],o=i[2];if(n){for(var s=n.toLowerCase().split("::").reverse(),a=l(s,2),h=a[0],u=a[1],c=u?u.split(":").map(H):[],f=h.split(":").map(H),d=e.IPV4ADDRESS.test(f[f.length-1]),m=d?7:8,p=f.length-m,g=Array(m),y=0;y<m;++y)g[y]=c[y]||f[p+y]||"";d&&(g[m-1]=V(g[m-1],e));var v=g.reduce((function(t,e,r){if(!e||"0"===e){var i=t[t.length-1];i&&i.index+i.length===r?i.length++:t.push({index:r,length:1})}return t}),[]),w=v.sort((function(t,e){return e.length-t.length}))[0],b=void 0;if(w&&w.length>1){var M=g.slice(0,w.index),_=g.slice(w.index+w.length);b=M.join(":")+"::"+_.join(":")}else b=g.join(":");return o&&(b+="%"+o),b}return t}var G=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,K=void 0==="".match(/(){0}/)[1];function J(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=!1!==e.iri?u:h;"suffix"===e.reference&&(t=(e.scheme?e.scheme+":":"")+"//"+t);var n=t.match(G);if(n){K?(r.scheme=n[1],r.userinfo=n[3],r.host=n[4],r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=n[7],r.fragment=n[8],isNaN(r.port)&&(r.port=n[5])):(r.scheme=n[1]||void 0,r.userinfo=-1!==t.indexOf("@")?n[3]:void 0,r.host=-1!==t.indexOf("//")?n[4]:void 0,r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=-1!==t.indexOf("?")?n[7]:void 0,r.fragment=-1!==t.indexOf("#")?n[8]:void 0,isNaN(r.port)&&(r.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),r.host&&(r.host=Z(V(r.host,i),i)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",e.reference&&"suffix"!==e.reference&&e.reference!==r.reference&&(r.error=r.error||"URI is not a "+e.reference+" reference.");var o=F[(e.scheme||r.scheme||"").toLowerCase()];if(e.unicodeSupport||o&&o.unicodeSupport)q(r,i);else{if(r.host&&(e.domainHost||o&&o.domainHost))try{r.host=L.toASCII(r.host.replace(i.PCT_ENCODED,z).toLowerCase())}catch(t){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+t}q(r,h)}o&&o.parse&&o.parse(r,e)}else r.error=r.error||"URI can not be parsed.";return r}function Q(t,e){var r=!1!==e.iri?u:h,i=[];return void 0!==t.userinfo&&(i.push(t.userinfo),i.push("@")),void 0!==t.host&&i.push(Z(V(String(t.host),r),r).replace(r.IPV6ADDRESS,(function(t,e,r){return"["+e+(r?"%25"+r:"")+"]"}))),"number"!=typeof t.port&&"string"!=typeof t.port||(i.push(":"),i.push(String(t.port))),i.length?i.join(""):void 0}var W=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,tt=/^\/?(?:.|\n)*?(?=\/|$)/;function et(t){for(var e=[];t.length;)if(t.match(W))t=t.replace(W,"");else if(t.match(Y))t=t.replace(Y,"/");else if(t.match(X))t=t.replace(X,"/"),e.pop();else if("."===t||".."===t)t="";else{var r=t.match(tt);if(!r)throw new Error("Unexpected dot segment condition");var i=r[0];t=t.slice(i.length),e.push(i)}return e.join("")}function rt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.iri?u:h,i=[],n=F[(e.scheme||t.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(t,e),t.host)if(r.IPV6ADDRESS.test(t.host));else if(e.domainHost||n&&n.domainHost)try{t.host=e.iri?L.toUnicode(t.host):L.toASCII(t.host.replace(r.PCT_ENCODED,z).toLowerCase())}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+r}q(t,r),"suffix"!==e.reference&&t.scheme&&(i.push(t.scheme),i.push(":"));var o=Q(t,e);if(void 0!==o&&("suffix"!==e.reference&&i.push("//"),i.push(o),t.path&&"/"!==t.path.charAt(0)&&i.push("/")),void 0!==t.path){var s=t.path;e.absolutePath||n&&n.absolutePath||(s=et(s)),void 0===o&&(s=s.replace(/^\/\//,"/%2F")),i.push(s)}return void 0!==t.query&&(i.push("?"),i.push(t.query)),void 0!==t.fragment&&(i.push("#"),i.push(t.fragment)),i.join("")}function it(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(t=J(rt(t,r),r),e=J(rt(e,r),r)),!(r=r||{}).tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=et(e.path||""),i.query=e.query):(void 0!==e.userinfo||void 0!==e.host||void 0!==e.port?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=et(e.path||""),i.query=e.query):(e.path?("/"===e.path.charAt(0)?i.path=et(e.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path:i.path="/"+e.path,i.path=et(i.path)),i.query=e.query):(i.path=t.path,void 0!==e.query?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function nt(t,e,r){var i=s({scheme:"null"},r);return rt(it(J(t,i),J(e,i),i,!0),i)}function ot(t,e){return"string"==typeof t?t=rt(J(t,e),e):"object"===i(t)&&(t=J(rt(t,e),e)),t}function st(t,e,r){return"string"==typeof t?t=rt(J(t,r),r):"object"===i(t)&&(t=rt(t,r)),"string"==typeof e?e=rt(J(e,r),r):"object"===i(e)&&(e=rt(e,r)),t===e}function at(t,e){return t&&t.toString().replace(e&&e.iri?u.ESCAPE:h.ESCAPE,j)}function ht(t,e){return t&&t.toString().replace(e&&e.iri?u.PCT_ENCODED:h.PCT_ENCODED,z)}var ut={scheme:"http",domainHost:!0,parse:function(t,e){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t},serialize:function(t,e){var r="https"===String(t.scheme).toLowerCase();return t.port!==(r?443:80)&&""!==t.port||(t.port=void 0),t.path||(t.path="/"),t}},lt={scheme:"https",domainHost:ut.domainHost,parse:ut.parse,serialize:ut.serialize};function ct(t){return"boolean"==typeof t.secure?t.secure:"wss"===String(t.scheme).toLowerCase()}var ft={scheme:"ws",domainHost:!0,parse:function(t,e){var r=t;return r.secure=ct(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(t,e){if(t.port!==(ct(t)?443:80)&&""!==t.port||(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){var r=t.resourceName.split("?"),i=l(r,2),n=i[0],o=i[1];t.path=n&&"/"!==n?n:void 0,t.query=o,t.resourceName=void 0}return t.fragment=void 0,t}},dt={scheme:"wss",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize},mt={},pt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",gt="[0-9A-Fa-f]",yt=r(r("%[EFef]"+gt+"%"+gt+gt+"%"+gt+gt)+"|"+r("%[89A-Fa-f]"+gt+"%"+gt+gt)+"|"+r("%"+gt+gt)),vt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",wt=e("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),bt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Mt=new RegExp(pt,"g"),_t=new RegExp(yt,"g"),Et=new RegExp(e("[^]",vt,"[\\.]",'[\\"]',wt),"g"),At=new RegExp(e("[^]",pt,bt),"g"),kt=At;function xt(t){var e=z(t);return e.match(Mt)?e:t}var Nt={scheme:"mailto",parse:function(t,e){var r=t,i=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var n=!1,o={},s=r.query.split("&"),a=0,h=s.length;a<h;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),c=0,f=l.length;c<f;++c)i.push(l[c]);break;case"subject":r.subject=ht(u[1],e);break;case"body":r.body=ht(u[1],e);break;default:n=!0,o[ht(u[0],e)]=ht(u[1],e)}}n&&(r.headers=o)}r.query=void 0;for(var d=0,m=i.length;d<m;++d){var p=i[d].split("@");if(p[0]=ht(p[0]),e.unicodeSupport)p[1]=ht(p[1],e).toLowerCase();else try{p[1]=L.toASCII(ht(p[1],e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+t}i[d]=p.join("@")}return r},serialize:function(t,e){var r=t,i=o(t.to);if(i){for(var s=0,a=i.length;s<a;++s){var h=String(i[s]),u=h.lastIndexOf("@"),l=h.slice(0,u).replace(_t,xt).replace(_t,n).replace(Et,j),c=h.slice(u+1);try{c=e.iri?L.toUnicode(c):L.toASCII(ht(c,e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+t}i[s]=l+"@"+c}r.path=i.join(",")}var f=t.headers=t.headers||{};t.subject&&(f.subject=t.subject),t.body&&(f.body=t.body);var d=[];for(var m in f)f[m]!==mt[m]&&d.push(m.replace(_t,xt).replace(_t,n).replace(At,j)+"="+f[m].replace(_t,xt).replace(_t,n).replace(kt,j));return d.length&&(r.query=d.join("&")),r}},St=/^([^\:]+)\:(.*)/,It={scheme:"urn",parse:function(t,e){var r=t.path&&t.path.match(St),i=t;if(r){var n=e.scheme||i.scheme||"urn",o=r[1].toLowerCase(),s=r[2],a=n+":"+(e.nid||o),h=F[a];i.nid=o,i.nss=s,i.path=void 0,h&&(i=h.parse(i,e))}else i.error=i.error||"URN can not be parsed.";return i},serialize:function(t,e){var r=e.scheme||t.scheme||"urn",i=t.nid,n=r+":"+(e.nid||i),o=F[n];o&&(t=o.serialize(t,e));var s=t,a=t.nss;return s.path=(i||e.nid)+":"+a,s}},Rt=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Tt={scheme:"urn:uuid",parse:function(t,e){var r=t;return r.uuid=r.nss,r.nss=void 0,e.tolerant||r.uuid&&r.uuid.match(Rt)||(r.error=r.error||"UUID is not valid."),r},serialize:function(t,e){var r=t;return r.nss=(t.uuid||"").toLowerCase(),r}};F[ut.scheme]=ut,F[lt.scheme]=lt,F[ft.scheme]=ft,F[dt.scheme]=dt,F[Nt.scheme]=Nt,F[It.scheme]=It,F[Tt.scheme]=Tt,t.SCHEMES=F,t.pctEncChar=j,t.pctDecChars=z,t.parse=J,t.removeDotSegments=et,t.serialize=rt,t.resolveComponents=it,t.resolve=nt,t.normalize=ot,t.equal=st,t.escapeComponent=at,t.unescapeComponent=ht,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));_c.code='require("ajv/dist/runtime/uri").default';var Ec=_c,Ac=Object.defineProperty({default:Ec},"__esModule",{value:!0}),kc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return dc.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return Wl._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return Wl.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return Wl.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return Wl.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return Wl.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return Wl.CodeGen}});const r=Wl,i=(t,e)=>new RegExp(t,e);i.code="new RegExp";const n=["removeAdditional","useDefaults","coerceTypes"],o=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),s={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},a={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function h(t){var e,r,n,o,s,a,h,u,l,c,f,d,m,p,g,y,v,w,b,M,_,E,A,k,x;const N=t.strict,S=null===(e=t.code)||void 0===e?void 0:e.optimize,I=!0===S||void 0===S?1:S||0,R=null!==(n=null===(r=t.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:i,T=null!==(o=t.uriResolver)&&void 0!==o?o:Ac.default;return{strictSchema:null===(a=null!==(s=t.strictSchema)&&void 0!==s?s:N)||void 0===a||a,strictNumbers:null===(u=null!==(h=t.strictNumbers)&&void 0!==h?h:N)||void 0===u||u,strictTypes:null!==(c=null!==(l=t.strictTypes)&&void 0!==l?l:N)&&void 0!==c?c:"log",strictTuples:null!==(d=null!==(f=t.strictTuples)&&void 0!==f?f:N)&&void 0!==d?d:"log",strictRequired:null!==(p=null!==(m=t.strictRequired)&&void 0!==m?m:N)&&void 0!==p&&p,code:t.code?{...t.code,optimize:I,regExp:R}:{optimize:I,regExp:R},loopRequired:null!==(g=t.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(y=t.loopEnum)&&void 0!==y?y:200,meta:null===(v=t.meta)||void 0===v||v,messages:null===(w=t.messages)||void 0===w||w,inlineRefs:null===(b=t.inlineRefs)||void 0===b||b,schemaId:null!==(M=t.schemaId)&&void 0!==M?M:"$id",addUsedSchema:null===(_=t.addUsedSchema)||void 0===_||_,validateSchema:null===(E=t.validateSchema)||void 0===E||E,validateFormats:null===(A=t.validateFormats)||void 0===A||A,unicodeRegExp:null===(k=t.unicodeRegExp)||void 0===k||k,int32range:null===(x=t.int32range)||void 0===x||x,uriResolver:T}}class u{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...h(t)};const{es5:e,lines:i}=this.opts.code;this.scope=new r.ValueScope({scope:{},prefixes:o,es5:e,lines:i}),this.logger=function(t){if(!1===t)return g;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}(t.logger);const n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,ic.getRules)(),l.call(this,s,t,"NOT SUPPORTED"),l.call(this,a,t,"DEPRECATED","warn"),this._metaOpts=p.call(this),t.formats&&d.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&m.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),f.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:e,schemaId:r}=this.opts;let i=Mc;"id"===r&&(i={...Mc},i.id=i.$id,delete i.$id),e&&t&&this.addMetaSchema(i,i[r],!1)}defaultMeta(){const{meta:t,schemaId:e}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[e]||t:void 0}validate(t,e){let r;if("string"==typeof t){if(r=this.getSchema(t),!r)throw new Error(`no schema with key or ref "${t}"`)}else r=this.compile(t);const i=r(e);return"$async"in r||(this.errors=r.errors),i}compile(t,e){const r=this._addSchema(t,e);return r.validate||this._compileSchemaEnv(r)}compileAsync(t,e){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return i.call(this,t,e);async function i(t,e){await n.call(this,t.$schema);const r=this._addSchema(t,e);return r.validate||o.call(this,r)}async function n(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function o(t){try{return this._compileSchemaEnv(t)}catch(e){if(!(e instanceof wc.default))throw e;return s.call(this,e),await a.call(this,e.missingSchema),o.call(this,t)}}function s({missingSchema:t,missingRef:e}){if(this.refs[t])throw new Error(`AnySchema ${t} is loaded but ${e} cannot be resolved`)}async function a(t){const r=await h.call(this,t);this.refs[t]||await n.call(this,r.$schema),this.refs[t]||this.addSchema(r,t,e)}async function h(t){const e=this._loading[t];if(e)return e;try{return await(this._loading[t]=r(t))}finally{delete this._loading[t]}}}addSchema(t,e,r,i=this.opts.validateSchema){if(Array.isArray(t)){for(const e of t)this.addSchema(e,void 0,r,i);return this}let n;if("object"==typeof t){const{schemaId:e}=this.opts;if(n=t[e],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${e} must be string`)}return e=(0,fc.normalizeId)(e||n),this._checkUnique(e),this.schemas[e]=this._addSchema(t,r,e,i,!0),this}addMetaSchema(t,e,r=this.opts.validateSchema){return this.addSchema(t,e,!0,r),this}validateSchema(t,e){if("boolean"==typeof t)return!0;let r;if(r=t.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(r,t);if(!i&&e){const t="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(t);this.logger.error(t)}return i}getSchema(t){let e;for(;"string"==typeof(e=c.call(this,t));)t=e;if(void 0===e){const{schemaId:r}=this.opts,i=new bc.SchemaEnv({schema:{},schemaId:r});if(e=bc.resolveSchema.call(this,i,t),!e)return;this.refs[t]=e}return e.validate||this._compileSchemaEnv(e)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const e=c.call(this,t);return"object"==typeof e&&this._cache.delete(e.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{const e=t;this._cache.delete(e);let r=t[this.opts.schemaId];return r&&(r=(0,fc.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const e of t)this.addKeyword(e);return this}addKeyword(t,e){let r;if("string"==typeof t)r=t,"object"==typeof e&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),e.keyword=r);else{if("object"!=typeof t||void 0!==e)throw new Error("invalid addKeywords parameters");if(r=(e=t).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(v.call(this,r,e),!e)return(0,Yl.eachItem)(r,(t=>w.call(this,t))),this;M.call(this,e);const i={...e,type:(0,oc.getJSONTypes)(e.type),schemaType:(0,oc.getJSONTypes)(e.schemaType)};return(0,Yl.eachItem)(r,0===i.type.length?t=>w.call(this,t,i):t=>i.type.forEach((e=>w.call(this,t,i,e)))),this}getKeyword(t){const e=this.RULES.all[t];return"object"==typeof e?e.definition:!!e}removeKeyword(t){const{RULES:e}=this;delete e.keywords[t],delete e.all[t];for(const r of e.rules){const e=r.rules.findIndex((e=>e.keyword===t));e>=0&&r.rules.splice(e,1)}return this}addFormat(t,e){return"string"==typeof e&&(e=new RegExp(e)),this.formats[t]=e,this}errorsText(t=this.errors,{separator:e=", ",dataVar:r="data"}={}){return t&&0!==t.length?t.map((t=>`${r}${t.instancePath} ${t.message}`)).reduce(((t,r)=>t+e+r)):"No errors"}$dataMetaSchema(t,e){const r=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const i of e){const e=i.split("/").slice(1);let n=t;for(const t of e)n=n[t];for(const t in r){const e=r[t];if("object"!=typeof e)continue;const{$data:i}=e.definition,o=n[t];i&&o&&(n[t]=E(o))}}return t}_removeAllSchemas(t,e){for(const r in t){const i=t[r];e&&!e.test(r)||("string"==typeof i?delete t[r]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[r]))}}_addSchema(t,e,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof t)o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof t)throw new Error("schema must be object or boolean")}let a=this._cache.get(t);if(void 0!==a)return a;r=(0,fc.normalizeId)(o||r);const h=fc.getSchemaRefs.call(this,t,r);return a=new bc.SchemaEnv({schema:t,schemaId:s,meta:e,baseId:r,localRefs:h}),this._cache.set(a.schema,a),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),i&&this.validateSchema(t,!0),a}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):bc.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const e=this.opts;this.opts=this._metaOpts;try{bc.compileSchema.call(this,t)}finally{this.opts=e}}}function l(t,e,r,i="error"){for(const n in t){const o=n;o in e&&this.logger[i](`${r}: option ${n}. ${t[o]}`)}}function c(t){return t=(0,fc.normalizeId)(t),this.schemas[t]||this.refs[t]}function f(){const t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(const e in t)this.addSchema(t[e],e)}function d(){for(const t in this.opts.formats){const e=this.opts.formats[t];e&&this.addFormat(t,e)}}function m(t){if(Array.isArray(t))this.addVocabulary(t);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const e in t){const r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}}function p(){const t={...this.opts};for(const e of n)delete t[e];return t}e.default=u,u.ValidationError=gc.default,u.MissingRefError=wc.default;const g={log(){},warn(){},error(){}};const y=/^[a-z_$][a-z0-9_$:-]*$/i;function v(t,e){const{RULES:r}=this;if((0,Yl.eachItem)(t,(t=>{if(r.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!y.test(t))throw new Error(`Keyword ${t} has invalid name`)})),e&&e.$data&&!("code"in e)&&!("validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function w(t,e,r){var i;const n=null==e?void 0:e.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=n?o.post:o.rules.find((({type:t})=>t===r));if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;const a={keyword:t,definition:{...e,type:(0,oc.getJSONTypes)(e.type),schemaType:(0,oc.getJSONTypes)(e.schemaType)}};e.before?b.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,null===(i=e.implements)||void 0===i||i.forEach((t=>this.addKeyword(t)))}function b(t,e,r){const i=t.rules.findIndex((t=>t.keyword===r));i>=0?t.rules.splice(i,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function M(t){let{metaSchema:e}=t;void 0!==e&&(t.$data&&this.opts.$data&&(e=E(e)),t.validateSchema=this.compile(e,!0))}const _={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function E(t){return{anyOf:[t,_]}}}));var xc={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}},Nc=Object.defineProperty({default:xc},"__esModule",{value:!0}),Sc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;const r={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:o}=t,{baseId:s,schemaEnv:a,validateName:h,opts:u,self:l}=o,{root:c}=a;if(("#"===r||"#/"===r)&&s===c.baseId)return function(){if(a===c)return n(t,h,a,a.$async);const r=e.scopeValue("root",{ref:c});return n(t,Wl._`${r}.validate`,c,c.$async)}();const f=bc.resolveRef.call(l,c,s,r);if(void 0===f)throw new wc.default(o.opts.uriResolver,s,r);return f instanceof bc.SchemaEnv?function(e){const r=i(t,e);n(t,r,e,e.$async)}(f):function(i){const n=e.scopeValue("schema",!0===u.code.source?{ref:i,code:(0,Wl.stringify)(i)}:{ref:i}),o=e.name("valid"),s=t.subschema({schema:i,dataTypes:[],schemaPath:Wl.nil,topSchemaRef:n,errSchemaPath:r},o);t.mergeEvaluated(s),t.ok(o)}(f)}};function i(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):Wl._`${r.scopeValue("wrapper",{ref:e})}.validate`}function n(t,e,r,i){const{gen:n,it:o}=t,{allErrors:s,schemaEnv:a,opts:h}=o,u=h.passContext?tc.default.this:Wl.nil;function l(t){const e=Wl._`${t}.errors`;n.assign(tc.default.vErrors,Wl._`${tc.default.vErrors} === null ? ${e} : ${tc.default.vErrors}.concat(${e})`),n.assign(tc.default.errors,Wl._`${tc.default.vErrors}.length`)}function c(t){var e;if(!o.opts.unevaluated)return;const i=null===(e=null==r?void 0:r.validate)||void 0===e?void 0:e.evaluated;if(!0!==o.props)if(i&&!i.dynamicProps)void 0!==i.props&&(o.props=Yl.mergeEvaluated.props(n,i.props,o.props));else{const e=n.var("props",Wl._`${t}.evaluated.props`);o.props=Yl.mergeEvaluated.props(n,e,o.props,Wl.Name)}if(!0!==o.items)if(i&&!i.dynamicItems)void 0!==i.items&&(o.items=Yl.mergeEvaluated.items(n,i.items,o.items));else{const e=n.var("items",Wl._`${t}.evaluated.items`);o.items=Yl.mergeEvaluated.items(n,e,o.items,Wl.Name)}}i?function(){if(!a.$async)throw new Error("async schema referenced by sync schema");const r=n.let("valid");n.try((()=>{n.code(Wl._`await ${(0,ac.callValidateCode)(t,e,u)}`),c(e),s||n.assign(r,!0)}),(t=>{n.if(Wl._`!(${t} instanceof ${o.ValidationError})`,(()=>n.throw(t))),l(t),s||n.assign(r,!1)})),t.ok(r)}():t.result((0,ac.callValidateCode)(t,e,u),(()=>c(e)),(()=>l(e)))}e.getValidate=i,e.callRef=n,e.default=r}));var Ic=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Nc.default,Sc.default],Rc=Object.defineProperty({default:Ic},"__esModule",{value:!0});const Tc=Wl.operators,Cc={maximum:{okStr:"<=",ok:Tc.LTE,fail:Tc.GT},minimum:{okStr:">=",ok:Tc.GTE,fail:Tc.LT},exclusiveMaximum:{okStr:"<",ok:Tc.LT,fail:Tc.GTE},exclusiveMinimum:{okStr:">",ok:Tc.GT,fail:Tc.LTE}},Pc={message:({keyword:t,schemaCode:e})=>Wl.str`must be ${Cc[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>Wl._`{comparison: ${Cc[t].okStr}, limit: ${e}}`},Oc={keyword:Object.keys(Cc),type:"number",schemaType:"number",$data:!0,error:Pc,code(t){const{keyword:e,data:r,schemaCode:i}=t;t.fail$data(Wl._`${r} ${Cc[e].fail} ${i} || isNaN(${r})`)}};var Bc=Oc,$c=Object.defineProperty({default:Bc},"__esModule",{value:!0});const Uc={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>Wl.str`must be multiple of ${t}`,params:({schemaCode:t})=>Wl._`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:i,it:n}=t,o=n.opts.multipleOfPrecision,s=e.let("res"),a=o?Wl._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:Wl._`${s} !== parseInt(${s})`;t.fail$data(Wl._`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};var Dc=Uc,Lc=Object.defineProperty({default:Dc},"__esModule",{value:!0});function Fc(t){const e=t.length;let r,i=0,n=0;for(;n<e;)i++,r=t.charCodeAt(n++),r>=55296&&r<=56319&&n<e&&(r=t.charCodeAt(n),56320==(64512&r)&&n++);return i}var jc=Fc;Fc.code='require("ajv/dist/runtime/ucs2length").default';var zc=Object.defineProperty({default:jc},"__esModule",{value:!0});const qc={message({keyword:t,schemaCode:e}){const r="maxLength"===t?"more":"fewer";return Wl.str`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>Wl._`{limit: ${t}}`},Hc={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:qc,code(t){const{keyword:e,data:r,schemaCode:i,it:n}=t,o="maxLength"===e?Wl.operators.GT:Wl.operators.LT,s=!1===n.opts.unicode?Wl._`${r}.length`:Wl._`${(0,Yl.useFunc)(t.gen,zc.default)}(${r})`;t.fail$data(Wl._`${s} ${o} ${i}`)}};var Vc=Hc,Zc=Object.defineProperty({default:Vc},"__esModule",{value:!0});var Gc={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>Wl.str`must match pattern "${t}"`,params:({schemaCode:t})=>Wl._`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:i,schemaCode:n,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?Wl._`(new RegExp(${n}, ${s}))`:(0,ac.usePattern)(t,i);t.fail$data(Wl._`!${a}.test(${e})`)}},Kc=Object.defineProperty({default:Gc},"__esModule",{value:!0});const Jc={message({keyword:t,schemaCode:e}){const r="maxProperties"===t?"more":"fewer";return Wl.str`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>Wl._`{limit: ${t}}`},Qc={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Jc,code(t){const{keyword:e,data:r,schemaCode:i}=t,n="maxProperties"===e?Wl.operators.GT:Wl.operators.LT;t.fail$data(Wl._`Object.keys(${r}).length ${n} ${i}`)}};var Wc=Qc,Yc=Object.defineProperty({default:Wc},"__esModule",{value:!0});const Xc={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>Wl.str`must have required property '${t}'`,params:({params:{missingProperty:t}})=>Wl._`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:i,data:n,$data:o,it:s}=t,{opts:a}=s;if(!o&&0===r.length)return;const h=r.length>=a.loopRequired;if(s.allErrors?function(){if(h||o)t.block$data(Wl.nil,u);else for(const e of r)(0,ac.checkReportMissingProp)(t,e)}():function(){const s=e.let("missing");if(h||o){const r=e.let("valid",!0);t.block$data(r,(()=>function(r,o){t.setParams({missingProperty:r}),e.forOf(r,i,(()=>{e.assign(o,(0,ac.propertyInData)(e,n,r,a.ownProperties)),e.if((0,Wl.not)(o),(()=>{t.error(),e.break()}))}),Wl.nil)}(s,r))),t.ok(r)}else e.if((0,ac.checkMissingProp)(t,r,s)),(0,ac.reportMissingProp)(t,s),e.else()}(),a.strictRequired){const e=t.parentSchema.properties,{definedProperties:i}=t.it;for(const t of r)if(void 0===(null==e?void 0:e[t])&&!i.has(t)){const e=`required property "${t}" is not defined at "${s.schemaEnv.baseId+s.errSchemaPath}" (strictRequired)`;(0,Yl.checkStrictMode)(s,e,s.opts.strictRequired)}}function u(){e.forOf("prop",i,(r=>{t.setParams({missingProperty:r}),e.if((0,ac.noPropertyInData)(e,n,r,a.ownProperties),(()=>t.error()))}))}}};var tf=Xc,ef=Object.defineProperty({default:tf},"__esModule",{value:!0});const rf={message({keyword:t,schemaCode:e}){const r="maxItems"===t?"more":"fewer";return Wl.str`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>Wl._`{limit: ${t}}`},nf={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:rf,code(t){const{keyword:e,data:r,schemaCode:i}=t,n="maxItems"===e?Wl.operators.GT:Wl.operators.LT;t.fail$data(Wl._`${r}.length ${n} ${i}`)}};var of=nf,sf=Object.defineProperty({default:of},"__esModule",{value:!0});lc.code='require("ajv/dist/runtime/equal").default';var af=lc,hf=Object.defineProperty({default:af},"__esModule",{value:!0});const uf={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>Wl.str`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>Wl._`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=t;if(!i&&!n)return;const h=e.let("valid"),u=o.items?(0,oc.getSchemaTypes)(o.items):[];function l(i,n){const o=e.name("item"),s=(0,oc.checkDataTypes)(u,o,a.opts.strictNumbers,oc.DataType.Wrong),l=e.const("indices",Wl._`{}`);e.for(Wl._`;${i}--;`,(()=>{e.let(o,Wl._`${r}[${i}]`),e.if(s,Wl._`continue`),u.length>1&&e.if(Wl._`typeof ${o} == "string"`,Wl._`${o} += "_"`),e.if(Wl._`typeof ${l}[${o}] == "number"`,(()=>{e.assign(n,Wl._`${l}[${o}]`),t.error(),e.assign(h,!1).break()})).code(Wl._`${l}[${o}] = ${i}`)}))}function c(i,n){const o=(0,Yl.useFunc)(e,hf.default),s=e.name("outer");e.label(s).for(Wl._`;${i}--;`,(()=>e.for(Wl._`${n} = ${i}; ${n}--;`,(()=>e.if(Wl._`${o}(${r}[${i}], ${r}[${n}])`,(()=>{t.error(),e.assign(h,!1).break(s)}))))))}t.block$data(h,(function(){const i=e.let("i",Wl._`${r}.length`),n=e.let("j");t.setParams({i:i,j:n}),e.assign(h,!0),e.if(Wl._`${i} > 1`,(()=>(u.length>0&&!u.some((t=>"object"===t||"array"===t))?l:c)(i,n)))}),Wl._`${s} === false`),t.ok(h)}};var lf=uf,cf=Object.defineProperty({default:lf},"__esModule",{value:!0});const ff={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>Wl._`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:i,schemaCode:n,schema:o}=t;i||o&&"object"==typeof o?t.fail$data(Wl._`!${(0,Yl.useFunc)(e,hf.default)}(${r}, ${n})`):t.fail(Wl._`${o} !== ${r}`)}};var df=ff,mf=Object.defineProperty({default:df},"__esModule",{value:!0});const pf={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>Wl._`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t;if(!i&&0===n.length)throw new Error("enum must have non-empty array");const a=n.length>=s.opts.loopEnum;let h;const u=()=>null!=h?h:h=(0,Yl.useFunc)(e,hf.default);let l;if(a||i)l=e.let("valid"),t.block$data(l,(function(){e.assign(l,!1),e.forOf("v",o,(t=>e.if(Wl._`${u()}(${r}, ${t})`,(()=>e.assign(l,!0).break()))))}));else{if(!Array.isArray(n))throw new Error("ajv implementation error");const t=e.const("vSchema",o);l=(0,Wl.or)(...n.map(((e,i)=>function(t,e){const i=n[e];return"object"==typeof i&&null!==i?Wl._`${u()}(${r}, ${t}[${e}])`:Wl._`${r} === ${i}`}(t,i))))}t.pass(l)}};var gf=pf,yf=Object.defineProperty({default:gf},"__esModule",{value:!0});var vf=[$c.default,Lc.default,Zc.default,Kc.default,Yc.default,ef.default,sf.default,cf.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},mf.default,yf.default],wf=Object.defineProperty({default:vf},"__esModule",{value:!0}),bf=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;const r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>Wl.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>Wl._`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:n}=e;Array.isArray(n)?i(t,n):(0,Yl.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function i(t,e){const{gen:r,schema:i,data:n,keyword:o,it:s}=t;s.items=!0;const a=r.const("len",Wl._`${n}.length`);if(!1===i)t.setParams({len:e.length}),t.pass(Wl._`${a} <= ${e.length}`);else if("object"==typeof i&&!(0,Yl.alwaysValidSchema)(s,i)){const i=r.var("valid",Wl._`${a} <= ${e.length}`);r.if((0,Wl.not)(i),(()=>function(i){r.forRange("i",e.length,a,(e=>{t.subschema({keyword:o,dataProp:e,dataPropType:Yl.Type.Num},i),s.allErrors||r.if((0,Wl.not)(i),(()=>r.break()))}))}(i))),t.ok(i)}}e.validateAdditionalItems=i,e.default=r})),Mf=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;const r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return i(t,"additionalItems",e);r.items=!0,(0,Yl.alwaysValidSchema)(r,e)||t.ok((0,ac.validateArray)(t))}};function i(t,e,r=t.schema){const{gen:i,parentSchema:n,data:o,keyword:s,it:a}=t;!function(t){const{opts:i,errSchemaPath:n}=a,o=r.length,h=o===t.minItems&&(o===t.maxItems||!1===t[e]);if(i.strictTuples&&!h){const t=`"${s}" is ${o}-tuple, but minItems or maxItems/${e} are not specified or different at path "${n}"`;(0,Yl.checkStrictMode)(a,t,i.strictTuples)}}(n),a.opts.unevaluated&&r.length&&!0!==a.items&&(a.items=Yl.mergeEvaluated.items(i,r.length,a.items));const h=i.name("valid"),u=i.const("len",Wl._`${o}.length`);r.forEach(((e,r)=>{(0,Yl.alwaysValidSchema)(a,e)||(i.if(Wl._`${u} > ${r}`,(()=>t.subschema({keyword:s,schemaProp:r,dataProp:r},h))),t.ok(h))}))}e.validateTuple=i,e.default=r}));var _f={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Mf.validateTuple)(t,"items")},Ef=Object.defineProperty({default:_f},"__esModule",{value:!0});const Af={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>Wl.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>Wl._`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:i}=t,{prefixItems:n}=r;i.items=!0,(0,Yl.alwaysValidSchema)(i,e)||(n?(0,bf.validateAdditionalItems)(t,n):t.ok((0,ac.validateArray)(t)))}};var kf=Af,xf=Object.defineProperty({default:kf},"__esModule",{value:!0});const Nf={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>void 0===e?Wl.str`must contain at least ${t} valid item(s)`:Wl.str`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>void 0===e?Wl._`{minContains: ${t}}`:Wl._`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;let s,a;const{minContains:h,maxContains:u}=i;o.opts.next?(s=void 0===h?1:h,a=u):s=1;const l=e.const("len",Wl._`${n}.length`);if(t.setParams({min:s,max:a}),void 0===a&&0===s)return void(0,Yl.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&s>a)return(0,Yl.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),void t.fail();if((0,Yl.alwaysValidSchema)(o,r)){let e=Wl._`${l} >= ${s}`;return void 0!==a&&(e=Wl._`${e} && ${l} <= ${a}`),void t.pass(e)}o.items=!0;const c=e.name("valid");function f(){const t=e.name("_valid"),r=e.let("count",0);d(t,(()=>e.if(t,(()=>function(t){e.code(Wl._`${t}++`),void 0===a?e.if(Wl._`${t} >= ${s}`,(()=>e.assign(c,!0).break())):(e.if(Wl._`${t} > ${a}`,(()=>e.assign(c,!1).break())),1===s?e.assign(c,!0):e.if(Wl._`${t} >= ${s}`,(()=>e.assign(c,!0))))}(r)))))}function d(r,i){e.forRange("i",0,l,(e=>{t.subschema({keyword:"contains",dataProp:e,dataPropType:Yl.Type.Num,compositeRule:!0},r),i()}))}void 0===a&&1===s?d(c,(()=>e.if(c,(()=>e.break())))):0===s?(e.let(c,!0),void 0!==a&&e.if(Wl._`${n}.length > 0`,f)):(e.let(c,!1),f()),t.result(c,(()=>t.reset()))}};var Sf=Nf,If=Object.defineProperty({default:Sf},"__esModule",{value:!0}),Rf=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0,e.error={message:({params:{property:t,depsCount:e,deps:r}})=>{const i=1===e?"property":"properties";return Wl.str`must have ${i} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:i}})=>Wl._`{property: ${t},
|