UNPKG

@simbachain/libsimba-js

Version:

libsimba-js is a library simplifying the use of SIMBAChain APIs. We aim to abstract away the various blockchain concepts, reducing the necessary time needed to get to working code.

10 lines 421 kB
/*! * @simbachain/libsimba-js * libsimba-js is a library simplifying the use of SIMBAChain APIs. We aim to abstract away the various blockchain concepts, reducing the necessary time needed to get to working code. * * @version v0.5.8 * @author Kieran David Evans <kieran.evans@simbachain.com> * @homepage * @repository git+https://github.com/simbachain/libsimba-js.git */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.libsimba=e():t.libsimba=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=297)}([function(t,e,r){"use strict";r.r(e);var n=r(4);r.d(e,"isBytesLike",(function(){return s})),r.d(e,"isBytes",(function(){return f})),r.d(e,"arrayify",(function(){return c})),r.d(e,"concat",(function(){return u})),r.d(e,"stripZeros",(function(){return h})),r.d(e,"zeroPad",(function(){return d})),r.d(e,"isHexString",(function(){return l})),r.d(e,"hexlify",(function(){return b})),r.d(e,"hexDataLength",(function(){return g})),r.d(e,"hexDataSlice",(function(){return m})),r.d(e,"hexConcat",(function(){return y})),r.d(e,"hexValue",(function(){return v})),r.d(e,"hexStripZeros",(function(){return w})),r.d(e,"hexZeroPad",(function(){return S})),r.d(e,"splitSignature",(function(){return x})),r.d(e,"joinSignature",(function(){return A}));const i=new n.Logger("bytes/5.0.0-beta.132");function o(t){return!!t.toHexString}function a(t){return t.slice?t:(t.slice=function(){let e=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(t,e)))},t)}function s(t){return l(t)&&!(t.length%2)||f(t)}function f(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(r<0||r>=256||r%1)return!1}return!0}function c(t,e){if(e||(e={}),"number"==typeof t){i.checkSafeUint53(t,"invalid arrayify value");let e=[];for(;t;)e.unshift(255&t),t/=256;return 0===e.length&&e.push(0),a(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),o(t)&&(t=t.toHexString()),l(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":i.throwArgumentError("hex data is odd-length","value",t));let n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return a(new Uint8Array(n))}return f(t)?a(new Uint8Array(t)):i.throwArgumentError("invalid arrayify value","value",t)}function u(t){let e=t.map(t=>c(t)),r=e.reduce((t,e)=>t+e.length,0),n=new Uint8Array(r);return e.reduce((t,e)=>(n.set(e,t),t+e.length),0),a(n)}function h(t){let e=c(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 d(t,e){(t=c(t)).length>e&&i.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),a(r)}function l(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const p="0123456789abcdef";function b(t,e){if(e||(e={}),"number"==typeof t){i.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=p[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),o(t))return t.toHexString();if(l(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":i.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(f(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=p[(240&n)>>4]+p[15&n]}return e}return i.throwArgumentError("invalid hexlify value","value",t)}function g(t){if("string"!=typeof t)t=b(t);else if(!l(t)||t.length%2)return null;return(t.length-2)/2}function m(t,e,r){return"string"!=typeof t?t=b(t):(!l(t)||t.length%2)&&i.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function y(t){let e="0x";return t.forEach(t=>{e+=b(t).substring(2)}),e}function v(t){let e=w(b(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function w(t){"string"!=typeof t&&(t=b(t)),l(t)||i.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)}function S(t,e){for("string"!=typeof t?t=b(t):l(t)||i.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&i.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function x(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(s(t)){let r=c(t);65!==r.length&&i.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=b(r.slice(0,32)),e.s=b(r.slice(32,64)),e.v=r[64],27!==e.v&&28!==e.v&&(e.v=27+e.v%2),e.recoveryParam=e.v-27,e.recoveryParam&&(r[32]|=128),e._vs=b(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.v&&27!=e.v&&28!=e.v&&(e.v=27+e.v%2),null==e.recoveryParam&&null!=e.v?e.recoveryParam=1-e.v%2:null!=e.recoveryParam&&null==e.v?e.v=27+e.recoveryParam:null!=e.recoveryParam&&null!=e.v&&e.v!==27+e.recoveryParam&&i.throwArgumentError("signature v mismatch recoveryParam","signature",t),null!=e.r&&(e.r=S(e.r,32)),null!=e.s&&(e.s=S(e.s,32)),null!=e._vs){e._vs=S(e._vs,32),e._vs.length>66&&i.throwArgumentError("signature _vs overflow","signature",t);let r=c(e._vs),n=r[0]>=128?1:0,o=27+e.recoveryParam;r[0]&=127;let a=b(r);null==e.s?e.s=a:e.s!==a&&i.throwArgumentError("signature v mismatch _vs","signature",t),null==e.v?e.v=o:e.v!==o&&i.throwArgumentError("signature v mismatch _vs","signature",t),null==n?e.recoveryParam=n:e.recoveryParam!==n&&i.throwArgumentError("signature recoveryParam mismatch _vs","signature",t)}if(null==e.v&&null==e.recoveryParam&&i.throwArgumentError("signature requires at least one of recoveryParam, v or _vs","signature",t),27!==e.v&&28!==e.v&&i.throwArgumentError("signature v not canonical","signature",t),(e.r.length>66||e.s.length>66)&&i.throwArgumentError("signature overflow r or s","signature",t),null==e._vs){let r=c(e.s);r[0]>=128&&i.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128),e._vs=b(r)}}return e}function A(t){return b(u([(t=x(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},function(t,e,r){"use strict";r.d(e,"g",(function(){return c})),r.d(e,"f",(function(){return u})),r.d(e,"a",(function(){return h})),r.d(e,"e",(function(){return d})),r.d(e,"b",(function(){return l})),r.d(e,"l",(function(){return p})),r.d(e,"c",(function(){return b})),r.d(e,"i",(function(){return g})),r.d(e,"d",(function(){return m})),r.d(e,"m",(function(){return y})),r.d(e,"k",(function(){return v})),r.d(e,"h",(function(){return w})),r.d(e,"n",(function(){return S})),r.d(e,"p",(function(){return x})),r.d(e,"o",(function(){return A})),r.d(e,"j",(function(){return M}));r(55),r(126);var n=r(165),i=r.n(n),o=r(10),a=r.n(o),s=r(166),f=function(t){function e(e,r){var n;return(n=t.call(this)||this).name="BaseException","response"in e?(n.message=e.response.data,n.cause=r||e):(n.message=e,n.cause=r),Error.captureStackTrace&&Error.captureStackTrace(i()(n),n.constructor),n}return a()(e,t),e}(r.n(s)()(Error)),c=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="NotImplementedException",e}return a()(e,t),e}(f),u=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="MissingMetadataException",e}return a()(e,t),e}(f),h=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="BadMetadataException",e}return a()(e,t),e}(f),d=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="MethodCallValidationMetadataException",e}return a()(e,t),e}(f),l=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="GenerateTransactionException",e}return a()(e,t),e}(f),p=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="SubmitTransactionException",e}return a()(e,t),e}(f),b=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="GetRequestException",e}return a()(e,t),e}(f),g=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="PostRequestException",e}return a()(e,t),e}(f),m=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="GetTransactionsException",e}return a()(e,t),e}(b),y=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="TransactionStatusCheckException",e}return a()(e,t),e}(f),v=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="SigningException",e}return a()(e,t),e}(f),w=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="NotInBrowserException",e}return a()(e,t),e}(f),S=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="UserRejectedSigningException",e}return a()(e,t),e}(v),x=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="WalletNotFoundException",e}return a()(e,t),e}(v),A=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="WalletLockedException",e}return a()(e,t),e}(v),M=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=t.call.apply(t,[this].concat(n))||this).name="RetriesExceededException",e}return a()(e,t),e}(v)},function(t,e,r){"use strict";r.r(e);var n=r(4);r.d(e,"defineReadOnly",(function(){return o})),r.d(e,"getStatic",(function(){return a})),r.d(e,"resolveProperties",(function(){return s})),r.d(e,"checkProperties",(function(){return f})),r.d(e,"shallowCopy",(function(){return c})),r.d(e,"deepCopy",(function(){return h})),r.d(e,"Description",(function(){return d}));const i=new n.Logger("properties/5.0.0-beta.133");function o(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function a(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 s(t){let e=Object.keys(t).map(e=>{let r=t[e];return r instanceof Promise?r.then(t=>({key:e,value:t})):Promise.resolve({key:e,value:r})});return Promise.all(e).then(t=>{return t.reduce((t,e)=>(t[e.key]=e.value,t),{})})}function f(t,e){t&&"object"==typeof t||i.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||i.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function c(t){let e={};for(let r in t)e[r]=t[r];return e}let u={bigint:!0,boolean:!0,number:!0,string:!0};function h(t){if(null==t||u[typeof t])return t;if(Array.isArray(t))return Object.freeze(t.map(t=>h(t)));if("object"==typeof t){if(Object.isFrozen(t))return t;let e={};for(let r in t){let n=t[r];void 0!==n&&o(e,r,h(n))}return e}if("function"==typeof t)return t;throw new Error("Cannot deepCopy "+typeof t)}class d{constructor(t){for(let e in t)this[e]=h(t[e]);Object.freeze(this)}}},function(t,e,r){t.exports=r(54)},function(t,e,r){"use strict";r.r(e);const n="logger/5.0.0-beta.131";r.d(e,"Logger",(function(){return u}));let i=!1,o=!1;const a={debug:1,default:2,info:2,warn:3,error:4,off:5};let s=a.default,f=null;let c=function(){try{let 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}();class u{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}setLogLevel(t){let e=a[t];null!=e?s=e:this.warn("invliad log level - "+t)}_log(t,e){s>a[t]||console.log.apply(console,e)}debug(...t){this._log(u.levels.DEBUG,t)}info(...t){this._log(u.levels.INFO,t)}warn(...t){this._log(u.levels.WARNING,t)}makeError(t,e,r){if(o)return new Error("unknown error");e||(e=u.errors.UNKNOWN_ERROR),r||(r={});let n=[];Object.keys(r).forEach(t=>{try{n.push(t+"="+JSON.stringify(r[t]))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}}),n.push("version="+this.version);let i=t;n.length&&(t+=" ("+n.join(", ")+")");let a=new Error(t);return a.reason=i,a.code=e,Object.keys(r).forEach((function(t){a[t]=r[t]})),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,u.errors.INVALID_ARGUMENT,{argument:e,value:r})}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),c&&this.throwError("platform missing String.prototype.normalize",u.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:c})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,u.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,u.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,u.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,u.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",u.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",u.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",u.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return f||(f=new u(n)),f}static setCensorship(t,e){if(i){if(!t)return;this.globalLogger().throwError("error censorship permanent",u.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}o=!!t,i=!!e}}u.errors={UNKNOWN_ERROR:"UNKNOWN_ERROR",NOT_IMPLEMENTED:"NOT_IMPLEMENTED",UNSUPPORTED_OPERATION:"UNSUPPORTED_OPERATION",NETWORK_ERROR:"NETWORK_ERROR",SERVER_ERROR:"SERVER_ERROR",TIMEOUT:"TIMEOUT",BUFFER_OVERRUN:"BUFFER_OVERRUN",NUMERIC_FAULT:"NUMERIC_FAULT",MISSING_NEW:"MISSING_NEW",INVALID_ARGUMENT:"INVALID_ARGUMENT",MISSING_ARGUMENT:"MISSING_ARGUMENT",UNEXPECTED_ARGUMENT:"UNEXPECTED_ARGUMENT",CALL_EXCEPTION:"CALL_EXCEPTION",INSUFFICIENT_FUNDS:"INSUFFICIENT_FUNDS",NONCE_EXPIRED:"NONCE_EXPIRED",REPLACEMENT_UNDERPRICED:"REPLACEMENT_UNDERPRICED",UNPREDICTABLE_GAS_LIMIT:"UNPREDICTABLE_GAS_LIMIT"},u.levels={DEBUG:"DEBUG",INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",OFF:"OFF"}},function(t,e,r){(function(e){var r="object",n=function(t){return t&&t.Math==Math&&t};t.exports=n(typeof globalThis==r&&globalThis)||n(typeof window==r&&window)||n(typeof self==r&&self)||n(typeof e==r&&e)||Function("return this")()}).call(this,r(36))},function(t,e,r){"use strict";var n,i=r(15),o=r(5),a=r(19),s=r(20),f=r(75),c=r(21),u=r(26),h=r(22).f,d=r(92),l=r(93),p=r(7),b=r(68),g=o.DataView,m=g&&g.prototype,y=o.Int8Array,v=y&&y.prototype,w=o.Uint8ClampedArray,S=w&&w.prototype,x=y&&d(y),A=v&&d(v),M=Object.prototype,E=M.isPrototypeOf,_=p("toStringTag"),O=b("TYPED_ARRAY_TAG"),P=!(!o.ArrayBuffer||!g),R=P&&!!l&&"Opera"!==f(o.opera),T=!1,k={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},I=function(t){return a(t)&&s(k,f(t))};for(n in k)o[n]||(R=!1);if((!R||"function"!=typeof x||x===Function.prototype)&&(x=function(){throw TypeError("Incorrect invocation")},R))for(n in k)o[n]&&l(o[n],x);if((!R||!A||A===M)&&(A=x.prototype,R))for(n in k)o[n]&&l(o[n].prototype,A);if(R&&d(S)!==A&&l(S,A),i&&!s(A,_))for(n in T=!0,h(A,_,{get:function(){return a(this)?this[O]:void 0}}),k)o[n]&&c(o[n],O,n);P&&l&&d(m)!==M&&l(m,M),t.exports={NATIVE_ARRAY_BUFFER:P,NATIVE_ARRAY_BUFFER_VIEWS:R,TYPED_ARRAY_TAG:T&&O,aTypedArray:function(t){if(I(t))return t;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(t){if(l){if(E.call(x,t))return t}else for(var e in k)if(s(k,n)){var r=o[e];if(r&&(t===r||E.call(r,t)))return t}throw TypeError("Target is not a typed array constructor")},exportProto:function(t,e,r){if(i){if(r)for(var n in k){var a=o[n];a&&s(a.prototype,t)&&delete a.prototype[t]}A[t]&&!r||u(A,t,r?e:R&&v[t]||e)}},exportStatic:function(t,e,r){var n,a;if(i){if(l){if(r)for(n in k)(a=o[n])&&s(a,t)&&delete a[t];if(x[t]&&!r)return;try{return u(x,t,r?e:R&&y[t]||e)}catch(t){}}for(n in k)!(a=o[n])||a[t]&&!r||u(a,t,e)}},isView:function(t){var e=f(t);return"DataView"===e||s(k,e)},isTypedArray:I,TypedArray:x,TypedArrayPrototype:A}},function(t,e,r){var n=r(5),i=r(51),o=r(68),a=r(114),s=n.Symbol,f=i("wks");t.exports=function(t){return f[t]||(f[t]=a&&s[t]||(a?s:o)("Symbol."+t))}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){function r(t,e,r,n,i,o,a){try{var s=t[o](a),f=s.value}catch(t){return void r(t)}s.done?e(f):Promise.resolve(f).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,f,"next",t)}function f(t){r(a,i,o,s,f,"throw",t)}s(void 0)}))}}},function(t,e){t.exports=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}},function(t,e,r){var n=r(5),i=r(39).f,o=r(21),a=r(26),s=r(84),f=r(172),c=r(112);t.exports=function(t,e){var r,u,h,d,l,p=t.target,b=t.global,g=t.stat;if(r=b?n:g?n[p]||s(p,{}):(n[p]||{}).prototype)for(u in e){if(d=e[u],h=t.noTargetGet?(l=i(r,u))&&l.value:r[u],!c(b?u:p+(g?".":"#")+u,t.forced)&&void 0!==h){if(typeof d==typeof h)continue;f(d,h)}(t.sham||h&&h.sham)&&o(d,"sham",!0),a(r,u,d,t)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(168),i=r.n(n),o=r(0);function a(t){return"0x"+i.a.keccak_256(Object(o.arrayify)(t))}},function(t,e,r){var n=r(38),i=Math.min;t.exports=function(t){return t>0?i(n(t),9007199254740991):0}},function(t,e,r){"use strict";r(80);var n=r(0);const i=new(r(4).Logger)("strings/5.0.0-beta.133");var o;function a(t,e){t=Object(n.arrayify)(t);let r=[],i=0;for(;i<t.length;){let n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,a=null;if(192==(224&n))o=1,a=127;else if(224==(240&n))o=2,a=2047;else{if(240!=(248&n)){if(!e){if(128==(192&n))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}continue}o=3,a=65535}if(i+o>t.length){if(!e)throw new Error("invalid utf8 byte sequence; too short");for(;i<t.length&&t[i]>>6==2;i++);continue}let s=n&(1<<8-o-1)-1;for(let e=0;e<o;e++){let e=t[i];if(128!=(192&e)){s=null;break}s=s<<6|63&e,i++}if(null!==s)if(s<=a){if(!e)throw new Error("invalid utf8 byte sequence; overlong")}else if(s>1114111){if(!e)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(s>=55296&&s<=57343){if(!e)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else r.push(s);else if(!e)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}return r}function s(t,e=o.current){e!=o.current&&(i.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;let i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");n=65536+((1023&n)<<10)+(1023&i),r.push(n>>18|240),r.push(n>>12&63|128),r.push(n>>6&63|128),r.push(63&n|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Object(n.arrayify)(r)}function f(t){return t.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t)))).join("")}function c(t,e=o.current){return a(s(t,e))}function u(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach(t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])}),n}function h(t){let e=0;return t.split(",").map(t=>{let r=t.split("-");return 1===r.length?r[1]="0":""===r[1]&&(r[1]="1"),{l:e+parseInt(r[0],16),h:e=parseInt(r[1],16)}})}function d(t,e){let r=0;for(let n=0;n<e.length;n++){let i=e[n];if(t>=(r+=i.l)&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(o||(o={}));const l=h("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"),p="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),b=[{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}],g=u("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"),m=u("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"),y=u("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})),v=h("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 w(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=c(t);var r;r=e.map(t=>{if(p.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=d(t,b);if(e)return[t+e.s];let r=g[t];if(r)return r;let n=m[t];if(n)return[t+n[0]];let i=y[t];return i||null}(t);return e||[t]}),(e=c(f(e=r.reduce((t,e)=>(e.forEach(e=>{t.push(e)}),t),[])),o.NFKC)).forEach(t=>{if(function(t){return!!d(t,v)}(t))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(t=>{if(function(t){return!!d(t,l)}(t))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let n=f(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}r.d(e,"c",(function(){return s})),r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return w}))},function(t,e,r){var n=r(8);t.exports=!n((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e,r){"use strict";var n=r(18),i=r(0),o=r(4);const a="bignumber/5.0.0-beta.133",s=new o.Logger(a),f={},c=9007199254740991;class u{constructor(t,e){s.checkNew(new.target,u),t!==f&&s.throwError("cannot call consturtor directly; use BigNumber.from",o.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return d(l(this).fromTwos(t))}toTwos(t){return d(l(this).toTwos(t))}abs(){return"-"===this._hex[0]?u.from(this._hex.substring(1)):this}add(t){return d(l(this).add(l(t)))}sub(t){return d(l(this).sub(l(t)))}div(t){return u.from(t).isZero()&&p("division by zero","div"),d(l(this).div(l(t)))}mul(t){return d(l(this).mul(l(t)))}mod(t){return d(l(this).mod(l(t)))}pow(t){return d(l(this).pow(l(t)))}maskn(t){return d(l(this).maskn(t))}eq(t){return l(this).eq(l(t))}lt(t){return l(this).lt(l(t))}lte(t){return l(this).lte(l(t))}gt(t){return l(this).gt(l(t))}gte(t){return l(this).gte(l(t))}isZero(){return l(this).isZero()}toNumber(){try{return l(this).toNumber()}catch(t){p("overflow","toNumber",this.toString())}return null}toString(){return 0!==arguments.length&&s.throwError("bigNumber.toString does not accept parameters",o.Logger.errors.UNEXPECTED_ARGUMENT,{}),l(this).toString(10)}toHexString(){return this._hex}static from(t){return t instanceof u?t:"string"==typeof t?t.match(/-?0x[0-9a-f]+/i)?new u(f,h(t)):t.match(/^-?[0-9]+$/)?new u(f,h(new n.BN(t))):s.throwArgumentError("invalid BigNumber string","value",t):"number"==typeof t?(t%1&&p("underflow","BigNumber.from",t),(t>=c||t<=-c)&&p("overflow","BigNumber.from",t),u.from(String(t))):"bigint"==typeof t?u.from(t.toString()):Object(i.isBytes)(t)?u.from(Object(i.hexlify)(t)):t._hex&&Object(i.isHexString)(t._hex)?u.from(t._hex):t.toHexString&&"string"==typeof(t=t.toHexString())?u.from(t):s.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]&&s.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 d(t){return u.from(h(t))}function l(t){let e=u.from(t).toHexString();return"-"===e[0]?new n.BN("-"+e.substring(3),16):new n.BN(e.substring(2),16)}function p(t,e,r){let n={fault:t,operation:e};return null!=r&&(n.value=r),s.throwError(t,o.Logger.errors.NUMERIC_FAULT,n)}new o.Logger(a),u.from(0),u.from(-1);let b="0";for(;b.length<256;)b+=b;r.d(e,"a",(function(){return u}))},function(t,e,r){var n=r(19);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=r(262).Buffer}catch(t){}function s(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;o<i;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("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 i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=t.length-6,n=0;r>=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,u=r;u<s;u+=n)c=f(t,u,u+n,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=f(t,u,t.length,e),u=0;u<a;u++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){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"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var u=f>>>26,h=67108863&f,d=Math.min(c,e.length-1),l=Math.max(0,c-t.length+1);l<=d;l++){var p=c-l|0;u+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[c]=0|h,f=0|u}return 0!==f?r.words[c]=0|f:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],f=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?c[6-f.length]+f+r:f+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=u[t],l=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:c[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,f="le"===e,c=new t(o),u=this.clone();if(f){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a<n.length;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var l=function(t,e,r){var n,i,o,a=t.words,s=e.words,f=r.words,c=0,u=0|a[0],h=8191&u,d=u>>>13,l=0|a[1],p=8191&l,b=l>>>13,g=0|a[2],m=8191&g,y=g>>>13,v=0|a[3],w=8191&v,S=v>>>13,x=0|a[4],A=8191&x,M=x>>>13,E=0|a[5],_=8191&E,O=E>>>13,P=0|a[6],R=8191&P,T=P>>>13,k=0|a[7],I=8191&k,B=k>>>13,j=0|a[8],C=8191&j,L=j>>>13,N=0|a[9],F=8191&N,U=N>>>13,D=0|s[0],z=8191&D,q=D>>>13,W=0|s[1],K=8191&W,G=W>>>13,H=0|s[2],V=8191&H,Y=H>>>13,J=0|s[3],Z=8191&J,X=J>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ct=st>>>13,ut=0|s[8],ht=8191&ut,dt=ut>>>13,lt=0|s[9],pt=8191&lt,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(h,z))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(d,z)|0))<<13)|0;c=((o=Math.imul(d,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(b,z)|0,o=Math.imul(b,q);var mt=(c+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,K)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,z),i=(i=Math.imul(m,q))+Math.imul(y,z)|0,o=Math.imul(y,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,G)|0;var yt=(c+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(d,V)|0))<<13)|0;c=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(S,z)|0,o=Math.imul(S,q),n=n+Math.imul(m,K)|0,i=(i=i+Math.imul(m,G)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,Y)|0;var vt=(c+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,q))+Math.imul(M,z)|0,o=Math.imul(M,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,X)|0;var wt=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(_,z),i=(i=Math.imul(_,q))+Math.imul(O,z)|0,o=Math.imul(O,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(m,Z)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var St=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;c=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(T,z)|0,o=Math.imul(T,q),n=n+Math.imul(_,K)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var xt=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(I,z),i=(i=Math.imul(I,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var At=(c+(n=n+Math.imul(h,ft)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ft)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Mt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,z),i=(i=Math.imul(F,q))+Math.imul(U,z)|0,o=Math.imul(U,q),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,G))+Math.imul(U,K)|0,o=Math.imul(U,G),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,Y)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ft)|0,o=o+Math.imul(S,ct)|0,n=n+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,dt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,dt)|0;var _t=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,Y