@walletconnect/ethereum-provider 1.7.5 → 1.7.8
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/umd/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("WalletConnectProvider",[],e):"object"==typeof exports?exports.WalletConnectProvider=e():t.WalletConnectProvider=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=57)}([function(t,e,n){"use strict";(function(t){n.d(e,"f",(function(){return a})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return f})),n.d(e,"e",(function(){return d})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return g})),n.d(e,"n",(function(){return m})),n.d(e,"p",(function(){return v})),n.d(e,"A",(function(){return _})),n.d(e,"z",(function(){return y})),n.d(e,"B",(function(){return w})),n.d(e,"v",(function(){return b})),n.d(e,"u",(function(){return M})),n.d(e,"s",(function(){return R})),n.d(e,"r",(function(){return S})),n.d(e,"t",(function(){return k})),n.d(e,"q",(function(){return A})),n.d(e,"m",(function(){return C})),n.d(e,"l",(function(){return O})),n.d(e,"k",(function(){return T})),n.d(e,"j",(function(){return I})),n.d(e,"x",(function(){return L})),n.d(e,"a",(function(){return N})),n.d(e,"y",(function(){return j})),n.d(e,"w",(function(){return U}));var r=n(26),o=n.n(r),i=n(52),s=n.n(i);function a(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?N(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return s()(t)}function f(t,e=!1){return u(h(t),e)}function d(t){return c(h(t))}function p(t){return l(h(t))}function g(e){return t.from(L(e),"hex")}function m(t){return a(g(t))}function v(t){return c(g(t))}function _(e){return t.from(e,"utf8")}function y(t){return a(_(t))}function w(t,e=!1){return u(_(t),e)}function b(t){return h(x(E(t)))}function M(t){return x(E(t))}function E(t){return B((t>>>0).toString(2))}function x(t){return new Uint8Array(P(t).map(t=>parseInt(t,2)))}function R(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function S(e){return t.isBuffer(e)}function k(t){return o.a.strict(t)&&!S(t)}function A(t){return!k(t)&&!S(t)&&void 0!==t.byteLength}function C(t){return S(t)?"buffer":k(t)?"typed-array":A(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function O(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":R(t)?"hex":"utf8"}function T(...e){return t.concat(e)}function I(...t){let e=[];return t.forEach(t=>e=e.concat(Array.from(t))),new Uint8Array([...e])}function P(t,e=8){const n=B(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}function B(t,e=8,n="0"){return function(t,e,n="0"){return q(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function L(t){return t.replace(/^0x/,"")}function N(t){return t.startsWith("0x")?t:"0x"+t}function j(t){return(t=B(t=L(t),2))&&(t=N(t)),t}function U(t){const e=t.startsWith("0x");return t=(t=L(t)).startsWith("0")?t.substring(1):t,e?N(t):t}function q(t,e,n,r="0"){const o=e-t.length;let i=t;if(o>0){const e=r.repeat(o);i=n?e+t:t+e}return i}}).call(this,n(21).Buffer)},function(t,e,n){"use strict";n.r(e);var r=n(24);const o=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],i=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],s=["eth_accounts","eth_chainId","net_version"],a={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var u=n(16),c=n.n(u),l=n(0);function h(t){return l.b(new Uint8Array(t))}function f(t){return l.e(new Uint8Array(t))}function d(t,e){return l.c(new Uint8Array(t),!e)}function p(t){return l.d(new Uint8Array(t))}function g(...t){return l.n(t.map(t=>l.c(new Uint8Array(t))).join("")).buffer}function m(t){return l.f(t).buffer}function v(t){return l.i(t)}function _(t,e){return l.g(t,!e)}function y(t){return l.h(t)}function w(...t){return l.k(...t)}function b(t){return l.z(t).buffer}function M(t){return l.A(t)}function E(t,e){return l.B(t,!e)}function x(t){return new c.a(t,10).toNumber()}function R(t){return l.o(t)}function S(t){return l.n(t).buffer}function k(t){return l.p(t)}function A(t){return new c.a(l.x(t),"hex").toNumber()}function C(t){return l.v(t)}function O(t){return l.u(t).buffer}function T(t){return new c.a(t).toString()}function I(t,e){const n=l.x(l.y(new c.a(t).toString(16)));return e?n:l.a(n)}var P=n(53);function B(t){return l.y(t)}function L(t){return l.a(t)}function N(t){return l.x(t)}function j(t){return l.w(l.a(t))}const U=n(5).payloadId;function q(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function D(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function J(t,e){let n;const r=a[t];return r&&(n=`https://${r}.infura.io/v3/${e}`),n}function F(t,e){let n;const r=J(t,e.infuraId);return e.custom&&e.custom[t]?n=e.custom[t]:r&&(n=r),n}function H(t){return""===t||"string"==typeof t&&""===t.trim()}function W(t){return!(t&&t.length)}function z(t){return l.r(t)}function Y(t){return l.t(t)}function $(t){return l.q(t)}function V(t){return l.m(t)}function K(t){return l.l(t)}function Q(t,e){return l.s(t,e)}function Z(t){return"object"==typeof t.params}function X(t){return void 0!==t.method}function G(t){return void 0!==t.result}function tt(t){return void 0!==t.error}function et(t){return void 0!==t.event}function nt(t){return o.includes(t)||t.startsWith("wc_")}function rt(t){return!!t.method.startsWith("wc_")||!i.includes(t.method)}function ot(t){t=Object(l.x)(t.toLowerCase());const e=Object(l.x)(Object(P.keccak_256)(M(t)));let n="";for(let r=0;r<t.length;r++)parseInt(e[r],16)>7?n+=t[r].toUpperCase():n+=t[r];return Object(l.a)(n)}const it=t=>!!t&&("0x"===t.toLowerCase().substring(0,2)&&(!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t))||t===ot(t))));function st(t){return W(t)||Q(t[0])||(t[0]=E(t[0])),t}function at(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!it(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){let e=t;return("number"==typeof t||"string"==typeof t&&!H(t))&&(Q(t)?"string"==typeof t&&(e=B(t)):e=I(t)),"string"==typeof e&&(e=j(e)),e}const n={from:B(t.from),to:void 0===t.to?"":B(t.to),gasPrice:void 0===t.gasPrice?"":e(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":e(t.gasLimit):e(t.gas),value:void 0===t.value?"":e(t.value),nonce:void 0===t.nonce?"":e(t.nonce),data:void 0===t.data?"":B(t.data)||"0x"},r=["gasPrice","gas","value","nonce"];return Object.keys(n).forEach(t=>{!n[t].trim().length&&r.includes(t)&&delete n[t]}),n}function ut(t,e){return async(...n)=>new Promise((r,o)=>{t.apply(e,[...n,(t,e)=>{null==t&&o(t),r(e)}])})}function ct(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}return{code:n,message:e}}var lt=n(28);function ht(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function ft(t,e){let n=dt(t);return n=Object.assign(Object.assign({},n),e),t=pt(n)}function dt(t){return lt.parse(t)}function pt(t){return lt.stringify(t)}function gt(t){return void 0!==t.bridge}function mt(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e);const o=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n));const i=function(t){const e=dt(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},o),i)}n.d(e,"detectEnv",(function(){return r.detectEnv})),n.d(e,"detectOS",(function(){return r.detectOS})),n.d(e,"isAndroid",(function(){return r.isAndroid})),n.d(e,"isIOS",(function(){return r.isIOS})),n.d(e,"isMobile",(function(){return r.isMobile})),n.d(e,"isNode",(function(){return r.isNode})),n.d(e,"isBrowser",(function(){return r.isBrowser})),n.d(e,"getFromWindow",(function(){return r.getFromWindow})),n.d(e,"getFromWindowOrThrow",(function(){return r.getFromWindowOrThrow})),n.d(e,"getDocumentOrThrow",(function(){return r.getDocumentOrThrow})),n.d(e,"getDocument",(function(){return r.getDocument})),n.d(e,"getNavigatorOrThrow",(function(){return r.getNavigatorOrThrow})),n.d(e,"getNavigator",(function(){return r.getNavigator})),n.d(e,"getLocationOrThrow",(function(){return r.getLocationOrThrow})),n.d(e,"getLocation",(function(){return r.getLocation})),n.d(e,"getCryptoOrThrow",(function(){return r.getCryptoOrThrow})),n.d(e,"getCrypto",(function(){return r.getCrypto})),n.d(e,"getLocalStorageOrThrow",(function(){return r.getLocalStorageOrThrow})),n.d(e,"getLocalStorage",(function(){return r.getLocalStorage})),n.d(e,"getClientMeta",(function(){return r.getClientMeta})),n.d(e,"safeJsonParse",(function(){return r.safeJsonParse})),n.d(e,"safeJsonStringify",(function(){return r.safeJsonStringify})),n.d(e,"setLocal",(function(){return r.setLocal})),n.d(e,"getLocal",(function(){return r.getLocal})),n.d(e,"removeLocal",(function(){return r.removeLocal})),n.d(e,"mobileLinkChoiceKey",(function(){return r.mobileLinkChoiceKey})),n.d(e,"formatIOSMobile",(function(){return r.formatIOSMobile})),n.d(e,"saveMobileLinkInfo",(function(){return r.saveMobileLinkInfo})),n.d(e,"getMobileRegistryEntry",(function(){return r.getMobileRegistryEntry})),n.d(e,"getMobileLinkRegistry",(function(){return r.getMobileLinkRegistry})),n.d(e,"getWalletRegistryUrl",(function(){return r.getWalletRegistryUrl})),n.d(e,"getDappRegistryUrl",(function(){return r.getDappRegistryUrl})),n.d(e,"formatMobileRegistryEntry",(function(){return r.formatMobileRegistryEntry})),n.d(e,"formatMobileRegistry",(function(){return r.formatMobileRegistry})),n.d(e,"reservedEvents",(function(){return o})),n.d(e,"signingMethods",(function(){return i})),n.d(e,"stateMethods",(function(){return s})),n.d(e,"infuraNetworks",(function(){return a})),n.d(e,"convertArrayBufferToBuffer",(function(){return h})),n.d(e,"convertArrayBufferToUtf8",(function(){return f})),n.d(e,"convertArrayBufferToHex",(function(){return d})),n.d(e,"convertArrayBufferToNumber",(function(){return p})),n.d(e,"concatArrayBuffers",(function(){return g})),n.d(e,"convertBufferToArrayBuffer",(function(){return m})),n.d(e,"convertBufferToUtf8",(function(){return v})),n.d(e,"convertBufferToHex",(function(){return _})),n.d(e,"convertBufferToNumber",(function(){return y})),n.d(e,"concatBuffers",(function(){return w})),n.d(e,"convertUtf8ToArrayBuffer",(function(){return b})),n.d(e,"convertUtf8ToBuffer",(function(){return M})),n.d(e,"convertUtf8ToHex",(function(){return E})),n.d(e,"convertUtf8ToNumber",(function(){return x})),n.d(e,"convertHexToBuffer",(function(){return R})),n.d(e,"convertHexToArrayBuffer",(function(){return S})),n.d(e,"convertHexToUtf8",(function(){return k})),n.d(e,"convertHexToNumber",(function(){return A})),n.d(e,"convertNumberToBuffer",(function(){return C})),n.d(e,"convertNumberToArrayBuffer",(function(){return O})),n.d(e,"convertNumberToUtf8",(function(){return T})),n.d(e,"convertNumberToHex",(function(){return I})),n.d(e,"toChecksumAddress",(function(){return ot})),n.d(e,"isValidAddress",(function(){return it})),n.d(e,"parsePersonalSign",(function(){return st})),n.d(e,"parseTransactionData",(function(){return at})),n.d(e,"sanitizeHex",(function(){return B})),n.d(e,"addHexPrefix",(function(){return L})),n.d(e,"removeHexPrefix",(function(){return N})),n.d(e,"removeHexLeadingZeros",(function(){return j})),n.d(e,"payloadId",(function(){return U})),n.d(e,"uuid",(function(){return q})),n.d(e,"logDeprecationWarning",(function(){return D})),n.d(e,"getInfuraRpcUrl",(function(){return J})),n.d(e,"getRpcUrl",(function(){return F})),n.d(e,"promisify",(function(){return ut})),n.d(e,"formatRpcError",(function(){return ct})),n.d(e,"isWalletConnectSession",(function(){return gt})),n.d(e,"parseWalletConnectUri",(function(){return mt})),n.d(e,"getQueryString",(function(){return ht})),n.d(e,"appendToQueryString",(function(){return ft})),n.d(e,"parseQueryString",(function(){return dt})),n.d(e,"formatQueryString",(function(){return pt})),n.d(e,"isEmptyString",(function(){return H})),n.d(e,"isEmptyArray",(function(){return W})),n.d(e,"isBuffer",(function(){return z})),n.d(e,"isTypedArray",(function(){return Y})),n.d(e,"isArrayBuffer",(function(){return $})),n.d(e,"getType",(function(){return V})),n.d(e,"getEncoding",(function(){return K})),n.d(e,"isHexString",(function(){return Q})),n.d(e,"isJsonRpcSubscription",(function(){return Z})),n.d(e,"isJsonRpcRequest",(function(){return X})),n.d(e,"isJsonRpcResponseSuccess",(function(){return G})),n.d(e,"isJsonRpcResponseError",(function(){return tt})),n.d(e,"isInternalEvent",(function(){return et})),n.d(e,"isReservedEvent",(function(){return nt})),n.d(e,"isSilentPayload",(function(){return rt}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return 256})),n.d(e,"g",(function(){return 256})),n.d(e,"a",(function(){return"AES-CBC"})),n.d(e,"f",(function(){return"SHA-256"})),n.d(e,"e",(function(){return"HMAC"})),n.d(e,"i",(function(){return"SHA-256"})),n.d(e,"j",(function(){return"SHA-512"})),n.d(e,"h",(function(){return 512})),n.d(e,"d",(function(){return"encrypt"})),n.d(e,"c",(function(){return"decrypt"})),n.d(e,"k",(function(){return"sign"})),n.d(e,"l",(function(){return"verify"}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"c",(function(){return o})),n.d(e,"b",(function(){return i})),n.d(e,"d",(function(){return s})),n.d(e,"e",(function(){return a}));const r="INTERNAL_ERROR",o="SERVER_ERROR",i=[-32700,-32600,-32601,-32602,-32603],s=[-32e3,-32099],a={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[o]:{code:-32e3,message:"Server error"}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(59),e),o(n(60),e)},function(t,e,n){"use strict";n(3);var r=n(10);n.d(e,"parseConnectionError",(function(){return r.d}));var o=n(29);n.o(o,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return o.IJsonRpcProvider})),n.o(o,"formatJsonRpcError")&&n.d(e,"formatJsonRpcError",(function(){return o.formatJsonRpcError})),n.o(o,"formatJsonRpcRequest")&&n.d(e,"formatJsonRpcRequest",(function(){return o.formatJsonRpcRequest})),n.o(o,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return o.isHttpUrl})),n.o(o,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return o.isJsonRpcError})),n.o(o,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return o.isJsonRpcResponse})),n.o(o,"payloadId")&&n.d(e,"payloadId",(function(){return o.payloadId}));var i=n(30);n.d(e,"formatJsonRpcError",(function(){return i.a})),n.d(e,"formatJsonRpcRequest",(function(){return i.b})),n.d(e,"payloadId",(function(){return i.c}));n(31);var s=n(32);n.o(s,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return s.IJsonRpcProvider})),n.o(s,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return s.isHttpUrl})),n.o(s,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return s.isJsonRpcError})),n.o(s,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return s.isJsonRpcResponse}));var a=n(36);n.d(e,"isHttpUrl",(function(){return a.a}));var u=n(37);n.d(e,"isJsonRpcError",(function(){return u.a})),n.d(e,"isJsonRpcResponse",(function(){return u.b}))},function(t,e,n){"use strict";function r(t){let e=void 0;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function o(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=o,e.getDocumentOrThrow=function(){return o("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return o("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return o("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return o("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return o("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){"use strict";n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return a})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(4),o=n(2);async function i(t,e=o.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===o.a?{length:o.b,name:o.a}:{hash:{name:o.f},name:o.e}}(e),!0,function(t){return t===o.a?[o.d,o.c]:[o.k,o.l]}(e))}async function s(t,e,n){const s=r.getSubtleCrypto(),a=await i(e,o.a),u=await s.encrypt({iv:t,name:o.a},a,n);return new Uint8Array(u)}async function a(t,e,n){const s=r.getSubtleCrypto(),a=await i(e,o.a),u=await s.decrypt({iv:t,name:o.a},a,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),s=await i(t,o.e),a=await n.sign({length:o.g,name:o.e},s,e);return new Uint8Array(a)}async function c(t,e){const n=r.getSubtleCrypto(),s=await i(t,o.e),a=await n.sign({length:o.h,name:o.e},s,e);return new Uint8Array(a)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:o.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:o.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(47),o=n(48);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return o.testNumeric(t)?e.NUMERIC:o.testAlphanumeric(t)?e.ALPHANUMERIC:o.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){"use strict";n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return s})),n.d(e,"d",(function(){return a}));var r=n(3);function o(t){return r.b.includes(t)}function i(t){return Object.keys(r.e).includes(t)?r.e[t]:r.e[r.a]}function s(t){const e=Object.values(r.e).find(e=>e.code===t);return e||r.e[r.a]}function a(t,e,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${e}`):t}},function(t,e,n){"use strict";function r(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return JSON.parse(t)}catch(e){return t}}function o(t){return"string"==typeof t?t:JSON.stringify(t)}n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return o}))},function(t,e,n){"use strict";var r=n(22);i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var o=i.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function i(t,e,n){return i.TYPED_ARRAY_SUPPORT||this instanceof i?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer)return function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var o;o=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);i.TYPED_ARRAY_SUPPORT?o.__proto__=i.prototype:o=c(t,o);return o}(t,e,n,r);if("string"==typeof e)return function(t,e){var n=0|h(e),r=a(t,n),o=r.write(e);o!==n&&(r=r.slice(0,o));return r}(t,e);return function(t,e){if(i.isBuffer(e)){var n=0|s(e.length),r=a(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(o=e.length)!=o?a(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var o;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new i(t,e,n)}function s(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function a(t,e){var n;return i.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=i.prototype:(null===(n=t)&&(n=new i(e)),n.length=e),n}function u(t,e){var n=a(t,e<0?0:0|s(e));if(!i.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|s(e.length),r=a(t,n),o=0;o<n;o+=1)r[o]=255&e[o];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function h(t){return i.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),i.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}(l(e,t.length-n),t,n,r)}(this,t,e,n)},i.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),i.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=i.prototype;else{var o=e-t;n=new i(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+t]}return n},i.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,s=r-n;if(this===t&&n<e&&e<r)for(o=s-1;o>=0;--o)t[o+e]=this[o+n];else if(s<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},i.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=i.isBuffer(t)?t:new i(t),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this},i.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var o=u(null,e),s=0;for(n=0;n<t.length;++n){var c=t[n];if(!i.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(o,s),s+=c.length}return o},i.byteLength=h,i.prototype._isBuffer=!0,i.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new i(t);return e.fill(0),e},t.exports.from=function(t){return new i(t)}},function(t,e,n){"use strict";var r=n(38);n.d(e,"randomBytes",(function(){return r.a}));var o=n(39);n.d(e,"aesCbcDecrypt",(function(){return o.a})),n.d(e,"aesCbcEncrypt",(function(){return o.b}));var i=n(40);n.d(e,"hmacSha256Sign",(function(){return i.a}));n(45),n(15),n(2)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){"use strict";var r=n(41);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime}));n(42);var o=n(43);n.o(o,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return o.isConstantTime}));var i=n(44);n.d(e,"isConstantTime",(function(){return i.a}))},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function o(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{s=n(62).Buffer}catch(t){}function a(t,e,n){for(var r=0,o=Math.min(t.length,n),i=e;i<o;i++){var s=t.charCodeAt(i)-48;r<<=4,r|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function u(t,e,n,r){for(var o=0,i=Math.min(t.length,n),s=e;s<i;s++){var a=t.charCodeAt(s)-48;o*=r,o+=a>=49?a-49+10:a>=17?a-17+10:a}return o}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var o=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&o++,16===e?this._parseHex(t,o):this._parseBase(t,e,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 o=0;o<this.length;o++)this.words[o]=0;var i,s,a=0;if("be"===n)for(o=t.length-1,i=0;o>=0;o-=3)s=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(o=0,i=0;o<t.length;o+=3)s=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,o,i=0;for(n=t.length-6,r=0;n>=e;n-=6)o=a(t,n,n+6),this.words[r]|=o<<i&67108863,this.words[r+1]|=o>>>26-i&4194303,(i+=24)>=26&&(i-=26,r++);n+6!==e&&(o=a(t,e,n+6),this.words[r]|=o<<i&67108863,this.words[r+1]|=o>>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,o=1;o<=67108863;o*=e)r++;r--,o=o/e|0;for(var i=t.length-n,s=i%r,a=Math.min(i,i-s)+n,c=0,l=n;l<a;l+=r)c=u(t,l,l+r,e),this.imuln(o),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var h=1;for(c=u(t,l,t.length,e),l=0;l<s;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},i.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},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<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"],l=[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 f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var o=0|t.words[0],i=0|e.words[0],s=o*i,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,f=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=f;d++){var p=c-d|0;l+=(s=(o=0|t.words[p])*(i=0|e.words[d])+h)/67108864|0,h=67108863&s}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var o=0,i=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<o|i)).toString(16);n=0!==(i=a>>>24-o&16777215)||s!==this.length-1?c[6-u.length]+u+n:u+n,(o+=2)>=26&&(o-=26,s--)}for(0!==i&&(n=i.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],d=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?g+n:c[f-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(i),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[a]=s;for(;a<i;a++)c[a]=0}else{for(a=0;a<i-o;a++)c[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[i-a-1]=s}return c},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var o=0;o<e;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,o=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},i.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var o=0,i=0;i<r.length;i++)e=(0|n.words[i])+(0|r.words[i])+o,this.words[i]=67108863&e,o=e>>>26;for(;0!==o&&i<n.length;i++)e=(0|n.words[i])+o,this.words[i]=67108863&e,o=e>>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,o=this.cmp(t);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(n=this,r=t):(n=t,r=this);for(var i=0,s=0;s<r.length;s++)i=(e=(0|n.words[s])-(0|r.words[s])+i)>>26,this.words[s]=67108863&e;for(;0!==i&&s<n.length;s++)i=(e=(0|n.words[s])+i)>>26,this.words[s]=67108863&e;if(0===i&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,n){var r,o,i,s=t.words,a=e.words,u=n.words,c=0,l=0|s[0],h=8191&l,f=l>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],v=8191&m,_=m>>>13,y=0|s[3],w=8191&y,b=y>>>13,M=0|s[4],E=8191&M,x=M>>>13,R=0|s[5],S=8191&R,k=R>>>13,A=0|s[6],C=8191&A,O=A>>>13,T=0|s[7],I=8191&T,P=T>>>13,B=0|s[8],L=8191&B,N=B>>>13,j=0|s[9],U=8191&j,q=j>>>13,D=0|a[0],J=8191&D,F=D>>>13,H=0|a[1],W=8191&H,z=H>>>13,Y=0|a[2],$=8191&Y,V=Y>>>13,K=0|a[3],Q=8191&K,Z=K>>>13,X=0|a[4],G=8191&X,tt=X>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,ot=0|a[6],it=8191&ot,st=ot>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,lt=0|a[8],ht=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,J))|0)+((8191&(o=(o=Math.imul(h,F))+Math.imul(f,J)|0))<<13)|0;c=((i=Math.imul(f,F))+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,J),o=(o=Math.imul(p,F))+Math.imul(g,J)|0,i=Math.imul(g,F);var vt=(c+(r=r+Math.imul(h,W)|0)|0)+((8191&(o=(o=o+Math.imul(h,z)|0)+Math.imul(f,W)|0))<<13)|0;c=((i=i+Math.imul(f,z)|0)+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(v,J),o=(o=Math.imul(v,F))+Math.imul(_,J)|0,i=Math.imul(_,F),r=r+Math.imul(p,W)|0,o=(o=o+Math.imul(p,z)|0)+Math.imul(g,W)|0,i=i+Math.imul(g,z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(o=(o=o+Math.imul(h,V)|0)+Math.imul(f,$)|0))<<13)|0;c=((i=i+Math.imul(f,V)|0)+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(w,J),o=(o=Math.imul(w,F))+Math.imul(b,J)|0,i=Math.imul(b,F),r=r+Math.imul(v,W)|0,o=(o=o+Math.imul(v,z)|0)+Math.imul(_,W)|0,i=i+Math.imul(_,z)|0,r=r+Math.imul(p,$)|0,o=(o=o+Math.imul(p,V)|0)+Math.imul(g,$)|0,i=i+Math.imul(g,V)|0;var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(o=(o=o+Math.imul(h,Z)|0)+Math.imul(f,Q)|0))<<13)|0;c=((i=i+Math.imul(f,Z)|0)+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(E,J),o=(o=Math.imul(E,F))+Math.imul(x,J)|0,i=Math.imul(x,F),r=r+Math.imul(w,W)|0,o=(o=o+Math.imul(w,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,r=r+Math.imul(v,$)|0,o=(o=o+Math.imul(v,V)|0)+Math.imul(_,$)|0,i=i+Math.imul(_,V)|0,r=r+Math.imul(p,Q)|0,o=(o=o+Math.imul(p,Z)|0)+Math.imul(g,Q)|0,i=i+Math.imul(g,Z)|0;var wt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(o=(o=o+Math.imul(h,tt)|0)+Math.imul(f,G)|0))<<13)|0;c=((i=i+Math.imul(f,tt)|0)+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,J),o=(o=Math.imul(S,F))+Math.imul(k,J)|0,i=Math.imul(k,F),r=r+Math.imul(E,W)|0,o=(o=o+Math.imul(E,z)|0)+Math.imul(x,W)|0,i=i+Math.imul(x,z)|0,r=r+Math.imul(w,$)|0,o=(o=o+Math.imul(w,V)|0)+Math.imul(b,$)|0,i=i+Math.imul(b,V)|0,r=r+Math.imul(v,Q)|0,o=(o=o+Math.imul(v,Z)|0)+Math.imul(_,Q)|0,i=i+Math.imul(_,Z)|0,r=r+Math.imul(p,G)|0,o=(o=o+Math.imul(p,tt)|0)+Math.imul(g,G)|0,i=i+Math.imul(g,tt)|0;var bt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(o=(o=o+Math.imul(h,rt)|0)+Math.imul(f,nt)|0))<<13)|0;c=((i=i+Math.imul(f,rt)|0)+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(C,J),o=(o=Math.imul(C,F))+Math.imul(O,J)|0,i=Math.imul(O,F),r=r+Math.imul(S,W)|0,o=(o=o+Math.imul(S,z)|0)+Math.imul(k,W)|0,i=i+Math.imul(k,z)|0,r=r+Math.imul(E,$)|0,o=(o=o+Math.imul(E,V)|0)+Math.imul(x,$)|0,i=i+Math.imul(x,V)|0,r=r+Math.imul(w,Q)|0,o=(o=o+Math.imul(w,Z)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Z)|0,r=r+Math.imul(v,G)|0,o=(o=o+Math.imul(v,tt)|0)+Math.imul(_,G)|0,i=i+Math.imul(_,tt)|0,r=r+Math.imul(p,nt)|0,o=(o=o+Math.imul(p,rt)|0)+Math.imul(g,nt)|0,i=i+Math.imul(g,rt)|0;var Mt=(c+(r=r+Math.imul(h,it)|0)|0)+((8191&(o=(o=o+Math.imul(h,st)|0)+Math.imul(f,it)|0))<<13)|0;c=((i=i+Math.imul(f,st)|0)+(o>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,J),o=(o=Math.imul(I,F))+Math.imul(P,J)|0,i=Math.imul(P,F),r=r+Math.imul(C,W)|0,o=(o=o+Math.imul(C,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,r=r+Math.imul(S,$)|0,o=(o=o+Math.imul(S,V)|0)+Math.imul(k,$)|0,i=i+Math.imul(k,V)|0,r=r+Math.imul(E,Q)|0,o=(o=o+Math.imul(E,Z)|0)+Math.imul(x,Q)|0,i=i+Math.imul(x,Z)|0,r=r+Math.imul(w,G)|0,o=(o=o+Math.imul(w,tt)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,tt)|0,r=r+Math.imul(v,nt)|0,o=(o=o+Math.imul(v,rt)|0)+Math.imul(_,nt)|0,i=i+Math.imul(_,rt)|0,r=r+Math.imul(p,it)|0,o=(o=o+Math.imul(p,st)|0)+Math.imul(g,it)|0,i=i+Math.imul(g,st)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(o=(o=o+Math.imul(h,ct)|0)+Math.imul(f,ut)|0))<<13)|0;c=((i=i+Math.imul(f,ct)|0)+(o>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(L,J),o=(o=Math.imul(L,F))+Math.imul(N,J)|0,i=Math.imul(N,F),r=r+Math.imul(I,W)|0,o=(o=o+Math.imul(I,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,r=r+Math.imul(C,$)|0,o=(o=o+Math.imul(C,V)|0)+Math.imul(O,$)|0,i=i+Math.imul(O,V)|0,r=r+Math.imul(S,Q)|0,o=(o=o+Math.imul(S,Z)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,Z)|0,r=r+Math.imul(E,G)|0,o=(o=o+Math.imul(E,tt)|0)+Math.imul(x,G)|0,i=i+Math.imul(x,tt)|0,r=r+Math.imul(w,nt)|0,o=(o=o+Math.imul(w,rt)|0)+Math.imul(b,nt)|0,i=i+Math.imul(b,rt)|0,r=r+Math.imul(v,it)|0,o=(o=o+Math.imul(v,st)|0)+Math.imul(_,it)|0,i=i+Math.imul(_,st)|0,r=r+Math.imul(p,ut)|0,o=(o=o+Math.imul(p,ct)|0)+Math.imul(g,ut)|0,i=i+Math.imul(g,ct)|0;var xt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(o=(o=o+Math.imul(h,ft)|0)+Math.imul(f,ht)|0))<<13)|0;c=((i=i+Math.imul(f,ft)|0)+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(U,J),o=(o=Math.imul(U,F))+Math.imul(q,J)|0,i=Math.imul(q,F),r=r+Math.imul(L,W)|0,o=(o=o+Math.imul(L,z)|0)+Math.imul(N,W)|0,i=i+Math.imul(N,z)|0,r=r+Math.imul(I,$)|0,o=(o=o+Math.imul(I,V)|0)+Math.imul(P,$)|0,i=i+Math.imul(P,V)|0,r=r+Math.imul(C,Q)|0,o=(o=o+Math.imul(C,Z)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Z)|0,r=r+Math.imul(S,G)|0,o=(o=o+Math.imul(S,tt)|0)+Math.imul(k,G)|0,i=i+Math.imul(k,tt)|0,r=r+Math.imul(E,nt)|0,o=(o=o+Math.imul(E,rt)|0)+Math.imul(x,nt)|0,i=i+Math.imul(x,rt)|0,r=r+Math.imul(w,it)|0,o=(o=o+Math.imul(w,st)|0)+Math.imul(b,it)|0,i=i+Math.imul(b,st)|0,r=r+Math.imul(v,ut)|0,o=(o=o+Math.imul(v,ct)|0)+Math.imul(_,ut)|0,i=i+Math.imul(_,ct)|0,r=r+Math.imul(p,ht)|0,o=(o=o+Math.imul(p,ft)|0)+Math.imul(g,ht)|0,i=i+Math.imul(g,ft)|0;var Rt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(o=(o=o+Math.imul(h,gt)|0)+Math.imul(f,pt)|0))<<13)|0;c=((i=i+Math.imul(f,gt)|0)+(o>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(U,W),o=(o=Math.imul(U,z))+Math.imul(q,W)|0,i=Math.imul(q,z),r=r+Math.imul(L,$)|0,o=(o=o+Math.imul(L,V)|0)+Math.imul(N,$)|0,i=i+Math.imul(N,V)|0,r=r+Math.imul(I,Q)|0,o=(o=o+Math.imul(I,Z)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Z)|0,r=r+Math.imul(C,G)|0,o=(o=o+Math.imul(C,tt)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,tt)|0,r=r+Math.imul(S,nt)|0,o=(o=o+Math.imul(S,rt)|0)+Math.imul(k,nt)|0,i=i+Math.imul(k,rt)|0,r=r+Math.imul(E,it)|0,o=(o=o+Math.imul(E,st)|0)+Math.imul(x,it)|0,i=i+Math.imul(x,st)|0,r=r+Math.imul(w,ut)|0,o=(o=o+Math.imul(w,ct)|0)+Math.imul(b,ut)|0,i=i+Math.imul(b,ct)|0,r=r+Math.imul(v,ht)|0,o=(o=o+Math.imul(v,ft)|0)+Math.imul(_,ht)|0,i=i+Math.imul(_,ft)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(o=(o=o+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;c=((i=i+Math.imul(g,gt)|0)+(o>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(U,$),o=(o=Math.imul(U,V))+Math.imul(q,$)|0,i=Math.imul(q,V),r=r+Math.imul(L,Q)|0,o=(o=o+Math.imul(L,Z)|0)+Math.imul(N,Q)|0,i=i+Math.imul(N,Z)|0,r=r+Math.imul(I,G)|0,o=(o=o+Math.imul(I,tt)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,o=(o=o+Math.imul(C,rt)|0)+Math.imul(O,nt)|0,i=i+Math.imul(O,rt)|0,r=r+Math.imul(S,it)|0,o=(o=o+Math.imul(S,st)|0)+Math.imul(k,it)|0,i=i+Math.imul(k,st)|0,r=r+Math.imul(E,ut)|0,o=(o=o+Math.imul(E,ct)|0)+Math.imul(x,ut)|0,i=i+Math.imul(x,ct)|0,r=r+Math.imul(w,ht)|0,o=(o=o+Math.imul(w,ft)|0)+Math.imul(b,ht)|0,i=i+Math.imul(b,ft)|0;var kt=(c+(r=r+Math.imul(v,pt)|0)|0)+((8191&(o=(o=o+Math.imul(v,gt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((i=i+Math.imul(_,gt)|0)+(o>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(U,Q),o=(o=Math.imul(U,Z))+Math.imul(q,Q)|0,i=Math.imul(q,Z),r=r+Math.imul(L,G)|0,o=(o=o+Math.imul(L,tt)|0)+Math.imul(N,G)|0,i=i+Math.imul(N,tt)|0,r=r+Math.imul(I,nt)|0,o=(o=o+Math.imul(I,rt)|0)+Math.imul(P,nt)|0,i=i+Math.imul(P,rt)|0,r=r+Math.imul(C,it)|0,o=(o=o+Math.imul(C,st)|0)+Math.imul(O,it)|0,i=i+Math.imul(O,st)|0,r=r+Math.imul(S,ut)|0,o=(o=o+Math.imul(S,ct)|0)+Math.imul(k,ut)|0,i=i+Math.imul(k,ct)|0,r=r+Math.imul(E,ht)|0,o=(o=o+Math.imul(E,ft)|0)+Math.imul(x,ht)|0,i=i+Math.imul(x,ft)|0;var At=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(o=(o=o+Math.imul(w,gt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((i=i+Math.imul(b,gt)|0)+(o>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(U,G),o=(o=Math.imul(U,tt))+Math.imul(q,G)|0,i=Math.imul(q,tt),r=r+Math.imul(L,nt)|0,o=(o=o+Math.imul(L,rt)|0)+Math.imul(N,nt)|0,i=i+Math.imul(N,rt)|0,r=r+Math.imul(I,it)|0,o=(o=o+Math.imul(I,st)|0)+Math.imul(P,it)|0,i=i+Math.imul(P,st)|0,r=r+Math.imul(C,ut)|0,o=(o=o+Math.imul(C,ct)|0)+Math.imul(O,ut)|0,i=i+Math.imul(O,ct)|0,r=r+Math.imul(S,ht)|0,o=(o=o+Math.imul(S,ft)|0)+Math.imul(k,ht)|0,i=i+Math.imul(k,ft)|0;var Ct=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(o=(o=o+Math.imul(E,gt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((i=i+Math.imul(x,gt)|0)+(o>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(U,nt),o=(o=Math.imul(U,rt))+Math.imul(q,nt)|0,i=Math.imul(q,rt),r=r+Math.imul(L,it)|0,o=(o=o+Math.imul(L,st)|0)+Math.imul(N,it)|0,i=i+Math.imul(N,st)|0,r=r+Math.imul(I,ut)|0,o=(o=o+Math.imul(I,ct)|0)+Math.imul(P,ut)|0,i=i+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,o=(o=o+Math.imul(C,ft)|0)+Math.imul(O,ht)|0,i=i+Math.imul(O,ft)|0;var Ot=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(o=(o=o+Math.imul(S,gt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((i=i+Math.imul(k,gt)|0)+(o>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(U,it),o=(o=Math.imul(U,st))+Math.imul(q,it)|0,i=Math.imul(q,st),r=r+Math.imul(L,ut)|0,o=(o=o+Math.imul(L,ct)|0)+Math.imul(N,ut)|0,i=i+Math.imul(N,ct)|0,r=r+Math.imul(I,ht)|0,o=(o=o+Math.imul(I,ft)|0)+Math.imul(P,ht)|0,i=i+Math.imul(P,ft)|0;var Tt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(o=(o=o+Math.imul(C,gt)|0)+Math.imul(O,pt)|0))<<13)|0;c=((i=i+Math.imul(O,gt)|0)+(o>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(U,ut),o=(o=Math.imul(U,ct))+Math.imul(q,ut)|0,i=Math.imul(q,ct),r=r+Math.imul(L,ht)|0,o=(o=o+Math.imul(L,ft)|0)+Math.imul(N,ht)|0,i=i+Math.imul(N,ft)|0;var It=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(o=(o=o+Math.imul(I,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((i=i+Math.imul(P,gt)|0)+(o>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(U,ht),o=(o=Math.imul(U,ft))+Math.imul(q,ht)|0,i=Math.imul(q,ft);var Pt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(o=(o=o+Math.imul(L,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((i=i+Math.imul(N,gt)|0)+(o>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Bt=(c+(r=Math.imul(U,pt))|0)+((8191&(o=(o=Math.imul(U,gt))+Math.imul(q,pt)|0))<<13)|0;return c=((i=Math.imul(q,gt))+(o>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=vt,u[2]=_t,u[3]=yt,u[4]=wt,u[5]=bt,u[6]=Mt,u[7]=Et,u[8]=xt,u[9]=Rt,u[10]=St,u[11]=kt,u[12]=At,u[13]=Ct,u[14]=Ot,u[15]=Tt,u[16]=It,u[17]=Pt,u[18]=Bt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(d=f),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):n<63?f(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,o=0,i=0;i<n.length-1;i++){var s=o;o=0;for(var a=67108863&r,u=Math.min(i,e.length-1),c=Math.max(0,i-t.length+1);c<=u;c++){var l=i-c,h=(0|t.words[l])*(0|e.words[c]),f=67108863&h;a=67108863&(f=f+a|0),o+=(s=(s=s+(h/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}n.words[i]=a,r=s,s=o}return 0!==r?n.words[i]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=i.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},g.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,o=0;o<e;o++)r|=(1&t)<<e-o-1,t>>=1;return r},g.prototype.permute=function(t,e,n,r,o,i){for(var s=0;s<i;s++)r[s]=e[t[s]],o[s]=n[t[s]]},g.prototype.transform=function(t,e,n,r,o,i){this.permute(i,t,e,n,r,o);for(var s=1;s<o;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),l=0;l<o;l+=a)for(var h=u,f=c,d=0;d<s;d++){var p=n[l+d],g=r[l+d],m=n[l+d+s],v=r[l+d+s],_=h*m-f*v;v=h*v+f*m,m=_,n[l+d]=p+m,r[l+d]=g+v,n[l+d+s]=p-m,r[l+d+s]=g-v,d!==a&&(_=u*h-c*f,f=u*f+c*h,h=_)}},g.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,o=0;for(n=n/2|0;n;n>>>=1)o++;return 1<<o+1+r},g.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var o=t[r];t[r]=t[n-r-1],t[n-r-1]=o,o=e[r],e[r]=-e[n-r-1],e[n-r-1]=-o}},g.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var o=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&o,n=o<67108864?0:o/67108864|0}return t},g.prototype.convert13b=function(t,e,n,o){for(var i=0,s=0;s<e;s++)i+=0|t[s],n[2*s]=8191&i,i>>>=13,n[2*s+1]=8191&i,i>>>=13;for(s=2*e;s<o;++s)n[s]=0;r(0===i),r(0==(-8192&i))},g.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},g.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),o=this.makeRBT(r),i=this.stub(r),s=new Array(r),a=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),f=n.words;f.length=r,this.convert13b(t.words,t.length,s,r),this.convert13b(e.words,e.length,c,r),this.transform(s,i,a,u,r,o),this.transform(c,i,l,h,r,o);for(var d=0;d<r;d++){var p=a[d]*l[d]-u[d]*h[d];u[d]=a[d]*h[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,r),this.transform(a,u,f,i,r,o),this.conjugate(f,i,r),this.normalize13b(f,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,i=(67108863&o)+(67108863&e);e>>=26,e+=o/67108864|0,e+=i>>>26,this.words[n]=67108863&i}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,o=n%26;e[n]=(t.words[r]&1<<o)>>>o}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,o=(t-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&i,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==o){for(e=this.length-1;e>=0;e--)this.words[e+o]=this.words[e];for(e=0;e<o;e++)this.words[e]=0;this.length+=o}return this.strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var o;r("number"==typeof t&&t>=0),o=e?(e-e%26)/26:0;var i=t%26,s=Math.min((t-i)/26,this.length),a=67108863^67108863>>>i<<i,u=n;if(o-=s,o=Math.max(0,o),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=o);c--){var h=0|this.words[c];this.words[c]=l<<26-i|h>>>i,l=h&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,o=1<<e;return!(this.length<=n)&&!!(this.words[n]&o)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var o=67108863^67108863>>>e<<e;this.words[this.length-1]&=o}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var o,i,s=t.length+n;this._expand(s);var a=0;for(o=0;o<t.length;o++){i=(0|this.words[o+n])+a;var u=(0|t.words[o])*e;a=((i-=67108863&u)>>26)-(u/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)a=(i=(0|this.words[o+n])+a)>>26,this.words[o+n]=67108863&i;if(0===a)return this.strip();for(r(-1===a),a=0,o=0;o<this.length;o++)a=(i=-(0|this.words[o])+a)>>26,this.words[o]=67108863&i;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,s=0|o.words[o.length-1];0!==(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,u=r.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,a&&(a.words[u]=1));for(var h=u-1;h>=0;h--){var f=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(o,f,h);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=f)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(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(),n&&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(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),o=t.andln(1),i=n.cmp(r);return i<0||1===o&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(e*n+(0|this.words[o]))%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*e;this.words[n]=o/t|0,e=o%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=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(h)),o.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(c)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,f=1;0==(n.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=e.cmp(n);if(o<0){var i=e;e=n,n=i}else if(0===o||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,o=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,s=n;0!==i&&s<this.length;s++){var a=0|this.words[s];i=(a+=i)>>>26,a&=67108863,this.words[s]=a}return 0!==i&&(this.words[s]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];e=o===t?0:o<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],o=0|t.words[n];if(r!==o){r<o?e=-1:r>o&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new M(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=i._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 E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},o(_,v),_.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=4194303&o,r=10;r<t.length;r++){var i=0|t.words[r];t.words[r-10]=(4194303&i)<<4|o>>>22,o=i}o>>>=22,t.words[r-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},o(y,v),o(w,v),o(b,v),b.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,o=67108863&r;r>>>=26,t.words[n]=o,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new y;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return m[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.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")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}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 i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var v=this.pow(h,new i(1).iushln(p-m-1));f=f.redMul(v),h=v.redSqr(),d=d.redMul(h),p=m}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===r&&0===l)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},o(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).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)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(61)(t))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=a(f);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";var r=n(33);n.o(r,"IJsonRpcConnection")&&n.d(e,"IJsonRpcConnection",(function(){return r.IJsonRpcConnection})),n.o(r,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return r.IJsonRpcProvider})),n.o(r,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return r.isHttpUrl})),n.o(r,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return r.isJsonRpcError})),n.o(r,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return r.isJsonRpcResponse}));n(14);var o=n(34);n.d(e,"IJsonRpcConnection",(function(){return o.a})),n.d(e,"IJsonRpcProvider",(function(){return o.b}));var i=n(35);n.o(i,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return i.isHttpUrl})),n.o(i,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse}))},function(t,e,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(n,r){function o(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&v(t,"error",e,n)}(t,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var o,i,s,a;if(c(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),s=i[e]),void 0===s)s=i[e]=n,++t._eventsCount;else if("function"==typeof s?s=i[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=l(t))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=f.bind(r);return o.listener=n,r.wrapFn=o,o}function p(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(o):m(o,o.length)}function g(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function m(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function v(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){r.once&&t.removeEventListener(e,o),n(i)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,e);else{var c=u.length,l=m(u,c);for(n=0;n<c;++n)i(l[n],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return c(e),this.on(t,d(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,d(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,o,i,s;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===e||n[i].listener===e){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,o),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";(function(t){
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("WalletConnectProvider",[],e):"object"==typeof exports?exports.WalletConnectProvider=e():t.WalletConnectProvider=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=57)}([function(t,e,n){"use strict";(function(t){n.d(e,"f",(function(){return a})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return f})),n.d(e,"e",(function(){return d})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return g})),n.d(e,"n",(function(){return m})),n.d(e,"p",(function(){return v})),n.d(e,"A",(function(){return _})),n.d(e,"z",(function(){return y})),n.d(e,"B",(function(){return w})),n.d(e,"v",(function(){return b})),n.d(e,"u",(function(){return M})),n.d(e,"s",(function(){return R})),n.d(e,"r",(function(){return S})),n.d(e,"t",(function(){return k})),n.d(e,"q",(function(){return A})),n.d(e,"m",(function(){return C})),n.d(e,"l",(function(){return O})),n.d(e,"k",(function(){return T})),n.d(e,"j",(function(){return I})),n.d(e,"x",(function(){return L})),n.d(e,"a",(function(){return N})),n.d(e,"y",(function(){return j})),n.d(e,"w",(function(){return U}));var r=n(26),o=n.n(r),i=n(52),s=n.n(i);function a(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?N(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return s()(t)}function f(t,e=!1){return u(h(t),e)}function d(t){return c(h(t))}function p(t){return l(h(t))}function g(e){return t.from(L(e),"hex")}function m(t){return a(g(t))}function v(t){return c(g(t))}function _(e){return t.from(e,"utf8")}function y(t){return a(_(t))}function w(t,e=!1){return u(_(t),e)}function b(t){return h(x(E(t)))}function M(t){return x(E(t))}function E(t){return B((t>>>0).toString(2))}function x(t){return new Uint8Array(P(t).map(t=>parseInt(t,2)))}function R(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function S(e){return t.isBuffer(e)}function k(t){return o.a.strict(t)&&!S(t)}function A(t){return!k(t)&&!S(t)&&void 0!==t.byteLength}function C(t){return S(t)?"buffer":k(t)?"typed-array":A(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function O(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":R(t)?"hex":"utf8"}function T(...e){return t.concat(e)}function I(...t){let e=[];return t.forEach(t=>e=e.concat(Array.from(t))),new Uint8Array([...e])}function P(t,e=8){const n=B(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}function B(t,e=8,n="0"){return function(t,e,n="0"){return q(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function L(t){return t.replace(/^0x/,"")}function N(t){return t.startsWith("0x")?t:"0x"+t}function j(t){return(t=B(t=L(t),2))&&(t=N(t)),t}function U(t){const e=t.startsWith("0x");return t=(t=L(t)).startsWith("0")?t.substring(1):t,e?N(t):t}function q(t,e,n,r="0"){const o=e-t.length;let i=t;if(o>0){const e=r.repeat(o);i=n?e+t:t+e}return i}}).call(this,n(21).Buffer)},function(t,e,n){"use strict";n.r(e);var r=n(24);const o=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],i=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],s=["eth_accounts","eth_chainId","net_version"],a={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var u=n(16),c=n.n(u),l=n(0);function h(t){return l.b(new Uint8Array(t))}function f(t){return l.e(new Uint8Array(t))}function d(t,e){return l.c(new Uint8Array(t),!e)}function p(t){return l.d(new Uint8Array(t))}function g(...t){return l.n(t.map(t=>l.c(new Uint8Array(t))).join("")).buffer}function m(t){return l.f(t).buffer}function v(t){return l.i(t)}function _(t,e){return l.g(t,!e)}function y(t){return l.h(t)}function w(...t){return l.k(...t)}function b(t){return l.z(t).buffer}function M(t){return l.A(t)}function E(t,e){return l.B(t,!e)}function x(t){return new c.a(t,10).toNumber()}function R(t){return l.o(t)}function S(t){return l.n(t).buffer}function k(t){return l.p(t)}function A(t){return new c.a(l.x(t),"hex").toNumber()}function C(t){return l.v(t)}function O(t){return l.u(t).buffer}function T(t){return new c.a(t).toString()}function I(t,e){const n=l.x(l.y(new c.a(t).toString(16)));return e?n:l.a(n)}var P=n(53);function B(t){return l.y(t)}function L(t){return l.a(t)}function N(t){return l.x(t)}function j(t){return l.w(l.a(t))}const U=n(5).payloadId;function q(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function D(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function J(t,e){let n;const r=a[t];return r&&(n=`https://${r}.infura.io/v3/${e}`),n}function F(t,e){let n;const r=J(t,e.infuraId);return e.custom&&e.custom[t]?n=e.custom[t]:r&&(n=r),n}function H(t){return""===t||"string"==typeof t&&""===t.trim()}function W(t){return!(t&&t.length)}function z(t){return l.r(t)}function Y(t){return l.t(t)}function $(t){return l.q(t)}function V(t){return l.m(t)}function K(t){return l.l(t)}function Q(t,e){return l.s(t,e)}function Z(t){return"object"==typeof t.params}function X(t){return void 0!==t.method}function G(t){return void 0!==t.result}function tt(t){return void 0!==t.error}function et(t){return void 0!==t.event}function nt(t){return o.includes(t)||t.startsWith("wc_")}function rt(t){return!!t.method.startsWith("wc_")||!i.includes(t.method)}function ot(t){t=Object(l.x)(t.toLowerCase());const e=Object(l.x)(Object(P.keccak_256)(M(t)));let n="";for(let r=0;r<t.length;r++)parseInt(e[r],16)>7?n+=t[r].toUpperCase():n+=t[r];return Object(l.a)(n)}const it=t=>!!t&&("0x"===t.toLowerCase().substring(0,2)&&(!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t))||t===ot(t))));function st(t){return W(t)||Q(t[0])||(t[0]=E(t[0])),t}function at(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!it(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){let e=t;return("number"==typeof t||"string"==typeof t&&!H(t))&&(Q(t)?"string"==typeof t&&(e=B(t)):e=I(t)),"string"==typeof e&&(e=j(e)),e}const n={from:B(t.from),to:void 0===t.to?void 0:B(t.to),gasPrice:void 0===t.gasPrice?"":e(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":e(t.gasLimit):e(t.gas),value:void 0===t.value?"":e(t.value),nonce:void 0===t.nonce?"":e(t.nonce),data:void 0===t.data?"":B(t.data)||"0x"},r=["gasPrice","gas","value","nonce"];return Object.keys(n).forEach(t=>{(void 0===n[t]||"string"==typeof n[t]&&!n[t].trim().length)&&r.includes(t)&&delete n[t]}),n}function ut(t,e){return async(...n)=>new Promise((r,o)=>{t.apply(e,[...n,(t,e)=>{null==t&&o(t),r(e)}])})}function ct(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}return{code:n,message:e}}var lt=n(28);function ht(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function ft(t,e){let n=dt(t);return n=Object.assign(Object.assign({},n),e),t=pt(n)}function dt(t){return lt.parse(t)}function pt(t){return lt.stringify(t)}function gt(t){return void 0!==t.bridge}function mt(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e);const o=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n));const i=function(t){const e=dt(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},o),i)}n.d(e,"detectEnv",(function(){return r.detectEnv})),n.d(e,"detectOS",(function(){return r.detectOS})),n.d(e,"isAndroid",(function(){return r.isAndroid})),n.d(e,"isIOS",(function(){return r.isIOS})),n.d(e,"isMobile",(function(){return r.isMobile})),n.d(e,"isNode",(function(){return r.isNode})),n.d(e,"isBrowser",(function(){return r.isBrowser})),n.d(e,"getFromWindow",(function(){return r.getFromWindow})),n.d(e,"getFromWindowOrThrow",(function(){return r.getFromWindowOrThrow})),n.d(e,"getDocumentOrThrow",(function(){return r.getDocumentOrThrow})),n.d(e,"getDocument",(function(){return r.getDocument})),n.d(e,"getNavigatorOrThrow",(function(){return r.getNavigatorOrThrow})),n.d(e,"getNavigator",(function(){return r.getNavigator})),n.d(e,"getLocationOrThrow",(function(){return r.getLocationOrThrow})),n.d(e,"getLocation",(function(){return r.getLocation})),n.d(e,"getCryptoOrThrow",(function(){return r.getCryptoOrThrow})),n.d(e,"getCrypto",(function(){return r.getCrypto})),n.d(e,"getLocalStorageOrThrow",(function(){return r.getLocalStorageOrThrow})),n.d(e,"getLocalStorage",(function(){return r.getLocalStorage})),n.d(e,"getClientMeta",(function(){return r.getClientMeta})),n.d(e,"safeJsonParse",(function(){return r.safeJsonParse})),n.d(e,"safeJsonStringify",(function(){return r.safeJsonStringify})),n.d(e,"setLocal",(function(){return r.setLocal})),n.d(e,"getLocal",(function(){return r.getLocal})),n.d(e,"removeLocal",(function(){return r.removeLocal})),n.d(e,"mobileLinkChoiceKey",(function(){return r.mobileLinkChoiceKey})),n.d(e,"formatIOSMobile",(function(){return r.formatIOSMobile})),n.d(e,"saveMobileLinkInfo",(function(){return r.saveMobileLinkInfo})),n.d(e,"getMobileRegistryEntry",(function(){return r.getMobileRegistryEntry})),n.d(e,"getMobileLinkRegistry",(function(){return r.getMobileLinkRegistry})),n.d(e,"getWalletRegistryUrl",(function(){return r.getWalletRegistryUrl})),n.d(e,"getDappRegistryUrl",(function(){return r.getDappRegistryUrl})),n.d(e,"formatMobileRegistryEntry",(function(){return r.formatMobileRegistryEntry})),n.d(e,"formatMobileRegistry",(function(){return r.formatMobileRegistry})),n.d(e,"reservedEvents",(function(){return o})),n.d(e,"signingMethods",(function(){return i})),n.d(e,"stateMethods",(function(){return s})),n.d(e,"infuraNetworks",(function(){return a})),n.d(e,"convertArrayBufferToBuffer",(function(){return h})),n.d(e,"convertArrayBufferToUtf8",(function(){return f})),n.d(e,"convertArrayBufferToHex",(function(){return d})),n.d(e,"convertArrayBufferToNumber",(function(){return p})),n.d(e,"concatArrayBuffers",(function(){return g})),n.d(e,"convertBufferToArrayBuffer",(function(){return m})),n.d(e,"convertBufferToUtf8",(function(){return v})),n.d(e,"convertBufferToHex",(function(){return _})),n.d(e,"convertBufferToNumber",(function(){return y})),n.d(e,"concatBuffers",(function(){return w})),n.d(e,"convertUtf8ToArrayBuffer",(function(){return b})),n.d(e,"convertUtf8ToBuffer",(function(){return M})),n.d(e,"convertUtf8ToHex",(function(){return E})),n.d(e,"convertUtf8ToNumber",(function(){return x})),n.d(e,"convertHexToBuffer",(function(){return R})),n.d(e,"convertHexToArrayBuffer",(function(){return S})),n.d(e,"convertHexToUtf8",(function(){return k})),n.d(e,"convertHexToNumber",(function(){return A})),n.d(e,"convertNumberToBuffer",(function(){return C})),n.d(e,"convertNumberToArrayBuffer",(function(){return O})),n.d(e,"convertNumberToUtf8",(function(){return T})),n.d(e,"convertNumberToHex",(function(){return I})),n.d(e,"toChecksumAddress",(function(){return ot})),n.d(e,"isValidAddress",(function(){return it})),n.d(e,"parsePersonalSign",(function(){return st})),n.d(e,"parseTransactionData",(function(){return at})),n.d(e,"sanitizeHex",(function(){return B})),n.d(e,"addHexPrefix",(function(){return L})),n.d(e,"removeHexPrefix",(function(){return N})),n.d(e,"removeHexLeadingZeros",(function(){return j})),n.d(e,"payloadId",(function(){return U})),n.d(e,"uuid",(function(){return q})),n.d(e,"logDeprecationWarning",(function(){return D})),n.d(e,"getInfuraRpcUrl",(function(){return J})),n.d(e,"getRpcUrl",(function(){return F})),n.d(e,"promisify",(function(){return ut})),n.d(e,"formatRpcError",(function(){return ct})),n.d(e,"isWalletConnectSession",(function(){return gt})),n.d(e,"parseWalletConnectUri",(function(){return mt})),n.d(e,"getQueryString",(function(){return ht})),n.d(e,"appendToQueryString",(function(){return ft})),n.d(e,"parseQueryString",(function(){return dt})),n.d(e,"formatQueryString",(function(){return pt})),n.d(e,"isEmptyString",(function(){return H})),n.d(e,"isEmptyArray",(function(){return W})),n.d(e,"isBuffer",(function(){return z})),n.d(e,"isTypedArray",(function(){return Y})),n.d(e,"isArrayBuffer",(function(){return $})),n.d(e,"getType",(function(){return V})),n.d(e,"getEncoding",(function(){return K})),n.d(e,"isHexString",(function(){return Q})),n.d(e,"isJsonRpcSubscription",(function(){return Z})),n.d(e,"isJsonRpcRequest",(function(){return X})),n.d(e,"isJsonRpcResponseSuccess",(function(){return G})),n.d(e,"isJsonRpcResponseError",(function(){return tt})),n.d(e,"isInternalEvent",(function(){return et})),n.d(e,"isReservedEvent",(function(){return nt})),n.d(e,"isSilentPayload",(function(){return rt}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return 256})),n.d(e,"g",(function(){return 256})),n.d(e,"a",(function(){return"AES-CBC"})),n.d(e,"f",(function(){return"SHA-256"})),n.d(e,"e",(function(){return"HMAC"})),n.d(e,"i",(function(){return"SHA-256"})),n.d(e,"j",(function(){return"SHA-512"})),n.d(e,"h",(function(){return 512})),n.d(e,"d",(function(){return"encrypt"})),n.d(e,"c",(function(){return"decrypt"})),n.d(e,"k",(function(){return"sign"})),n.d(e,"l",(function(){return"verify"}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"c",(function(){return o})),n.d(e,"b",(function(){return i})),n.d(e,"d",(function(){return s})),n.d(e,"e",(function(){return a}));const r="INTERNAL_ERROR",o="SERVER_ERROR",i=[-32700,-32600,-32601,-32602,-32603],s=[-32e3,-32099],a={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[o]:{code:-32e3,message:"Server error"}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(59),e),o(n(60),e)},function(t,e,n){"use strict";n(3);var r=n(10);n.d(e,"parseConnectionError",(function(){return r.d}));var o=n(29);n.o(o,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return o.IJsonRpcProvider})),n.o(o,"formatJsonRpcError")&&n.d(e,"formatJsonRpcError",(function(){return o.formatJsonRpcError})),n.o(o,"formatJsonRpcRequest")&&n.d(e,"formatJsonRpcRequest",(function(){return o.formatJsonRpcRequest})),n.o(o,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return o.isHttpUrl})),n.o(o,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return o.isJsonRpcError})),n.o(o,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return o.isJsonRpcResponse})),n.o(o,"payloadId")&&n.d(e,"payloadId",(function(){return o.payloadId}));var i=n(30);n.d(e,"formatJsonRpcError",(function(){return i.a})),n.d(e,"formatJsonRpcRequest",(function(){return i.b})),n.d(e,"payloadId",(function(){return i.c}));n(31);var s=n(32);n.o(s,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return s.IJsonRpcProvider})),n.o(s,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return s.isHttpUrl})),n.o(s,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return s.isJsonRpcError})),n.o(s,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return s.isJsonRpcResponse}));var a=n(36);n.d(e,"isHttpUrl",(function(){return a.a}));var u=n(37);n.d(e,"isJsonRpcError",(function(){return u.a})),n.d(e,"isJsonRpcResponse",(function(){return u.b}))},function(t,e,n){"use strict";function r(t){let e=void 0;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function o(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=o,e.getDocumentOrThrow=function(){return o("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return o("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return o("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return o("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return o("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){"use strict";n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return a})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(4),o=n(2);async function i(t,e=o.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===o.a?{length:o.b,name:o.a}:{hash:{name:o.f},name:o.e}}(e),!0,function(t){return t===o.a?[o.d,o.c]:[o.k,o.l]}(e))}async function s(t,e,n){const s=r.getSubtleCrypto(),a=await i(e,o.a),u=await s.encrypt({iv:t,name:o.a},a,n);return new Uint8Array(u)}async function a(t,e,n){const s=r.getSubtleCrypto(),a=await i(e,o.a),u=await s.decrypt({iv:t,name:o.a},a,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),s=await i(t,o.e),a=await n.sign({length:o.g,name:o.e},s,e);return new Uint8Array(a)}async function c(t,e){const n=r.getSubtleCrypto(),s=await i(t,o.e),a=await n.sign({length:o.h,name:o.e},s,e);return new Uint8Array(a)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:o.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:o.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(47),o=n(48);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return o.testNumeric(t)?e.NUMERIC:o.testAlphanumeric(t)?e.ALPHANUMERIC:o.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){"use strict";n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return s})),n.d(e,"d",(function(){return a}));var r=n(3);function o(t){return r.b.includes(t)}function i(t){return Object.keys(r.e).includes(t)?r.e[t]:r.e[r.a]}function s(t){const e=Object.values(r.e).find(e=>e.code===t);return e||r.e[r.a]}function a(t,e,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${e}`):t}},function(t,e,n){"use strict";function r(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return JSON.parse(t)}catch(e){return t}}function o(t){return"string"==typeof t?t:JSON.stringify(t)}n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return o}))},function(t,e,n){"use strict";var r=n(22);i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var o=i.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function i(t,e,n){return i.TYPED_ARRAY_SUPPORT||this instanceof i?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer)return function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var o;o=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);i.TYPED_ARRAY_SUPPORT?o.__proto__=i.prototype:o=c(t,o);return o}(t,e,n,r);if("string"==typeof e)return function(t,e){var n=0|h(e),r=a(t,n),o=r.write(e);o!==n&&(r=r.slice(0,o));return r}(t,e);return function(t,e){if(i.isBuffer(e)){var n=0|s(e.length),r=a(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(o=e.length)!=o?a(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var o;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new i(t,e,n)}function s(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function a(t,e){var n;return i.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=i.prototype:(null===(n=t)&&(n=new i(e)),n.length=e),n}function u(t,e){var n=a(t,e<0?0:0|s(e));if(!i.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|s(e.length),r=a(t,n),o=0;o<n;o+=1)r[o]=255&e[o];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function h(t){return i.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),i.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}(l(e,t.length-n),t,n,r)}(this,t,e,n)},i.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),i.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=i.prototype;else{var o=e-t;n=new i(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+t]}return n},i.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,s=r-n;if(this===t&&n<e&&e<r)for(o=s-1;o>=0;--o)t[o+e]=this[o+n];else if(s<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},i.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=i.isBuffer(t)?t:new i(t),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this},i.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var o=u(null,e),s=0;for(n=0;n<t.length;++n){var c=t[n];if(!i.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(o,s),s+=c.length}return o},i.byteLength=h,i.prototype._isBuffer=!0,i.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new i(t);return e.fill(0),e},t.exports.from=function(t){return new i(t)}},function(t,e,n){"use strict";var r=n(38);n.d(e,"randomBytes",(function(){return r.a}));var o=n(39);n.d(e,"aesCbcDecrypt",(function(){return o.a})),n.d(e,"aesCbcEncrypt",(function(){return o.b}));var i=n(40);n.d(e,"hmacSha256Sign",(function(){return i.a}));n(45),n(15),n(2)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){"use strict";var r=n(41);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime}));n(42);var o=n(43);n.o(o,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return o.isConstantTime}));var i=n(44);n.d(e,"isConstantTime",(function(){return i.a}))},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function o(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var s;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{s=n(62).Buffer}catch(t){}function a(t,e,n){for(var r=0,o=Math.min(t.length,n),i=e;i<o;i++){var s=t.charCodeAt(i)-48;r<<=4,r|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function u(t,e,n,r){for(var o=0,i=Math.min(t.length,n),s=e;s<i;s++){var a=t.charCodeAt(s)-48;o*=r,o+=a>=49?a-49+10:a>=17?a-17+10:a}return o}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var o=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&o++,16===e?this._parseHex(t,o):this._parseBase(t,e,o),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 o=0;o<this.length;o++)this.words[o]=0;var i,s,a=0;if("be"===n)for(o=t.length-1,i=0;o>=0;o-=3)s=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(o=0,i=0;o<t.length;o+=3)s=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,o,i=0;for(n=t.length-6,r=0;n>=e;n-=6)o=a(t,n,n+6),this.words[r]|=o<<i&67108863,this.words[r+1]|=o>>>26-i&4194303,(i+=24)>=26&&(i-=26,r++);n+6!==e&&(o=a(t,e,n+6),this.words[r]|=o<<i&67108863,this.words[r+1]|=o>>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,o=1;o<=67108863;o*=e)r++;r--,o=o/e|0;for(var i=t.length-n,s=i%r,a=Math.min(i,i-s)+n,c=0,l=n;l<a;l+=r)c=u(t,l,l+r,e),this.imuln(o),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var h=1;for(c=u(t,l,t.length,e),l=0;l<s;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},i.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},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<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"],l=[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 f(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var o=0|t.words[0],i=0|e.words[0],s=o*i,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,f=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=f;d++){var p=c-d|0;l+=(s=(o=0|t.words[p])*(i=0|e.words[d])+h)/67108864|0,h=67108863&s}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var o=0,i=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<o|i)).toString(16);n=0!==(i=a>>>24-o&16777215)||s!==this.length-1?c[6-u.length]+u+n:u+n,(o+=2)>=26&&(o-=26,s--)}for(0!==i&&(n=i.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],d=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?g+n:c[f-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(i),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[a]=s;for(;a<i;a++)c[a]=0}else{for(a=0;a<i-o;a++)c[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[i-a-1]=s}return c},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var o=0;o<e;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,o=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<o:this.words[n]&~(1<<o),this.strip()},i.prototype.iadd=function(t){var e,n,r;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?(n=this,r=t):(n=t,r=this);for(var o=0,i=0;i<r.length;i++)e=(0|n.words[i])+(0|r.words[i])+o,this.words[i]=67108863&e,o=e>>>26;for(;0!==o&&i<n.length;i++)e=(0|n.words[i])+o,this.words[i]=67108863&e,o=e>>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,o=this.cmp(t);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(n=this,r=t):(n=t,r=this);for(var i=0,s=0;s<r.length;s++)i=(e=(0|n.words[s])-(0|r.words[s])+i)>>26,this.words[s]=67108863&e;for(;0!==i&&s<n.length;s++)i=(e=(0|n.words[s])+i)>>26,this.words[s]=67108863&e;if(0===i&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,n){var r,o,i,s=t.words,a=e.words,u=n.words,c=0,l=0|s[0],h=8191&l,f=l>>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],v=8191&m,_=m>>>13,y=0|s[3],w=8191&y,b=y>>>13,M=0|s[4],E=8191&M,x=M>>>13,R=0|s[5],S=8191&R,k=R>>>13,A=0|s[6],C=8191&A,O=A>>>13,T=0|s[7],I=8191&T,P=T>>>13,B=0|s[8],L=8191&B,N=B>>>13,j=0|s[9],U=8191&j,q=j>>>13,D=0|a[0],J=8191&D,F=D>>>13,H=0|a[1],W=8191&H,z=H>>>13,Y=0|a[2],$=8191&Y,V=Y>>>13,K=0|a[3],Q=8191&K,Z=K>>>13,X=0|a[4],G=8191&X,tt=X>>>13,et=0|a[5],nt=8191&et,rt=et>>>13,ot=0|a[6],it=8191&ot,st=ot>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,lt=0|a[8],ht=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var mt=(c+(r=Math.imul(h,J))|0)+((8191&(o=(o=Math.imul(h,F))+Math.imul(f,J)|0))<<13)|0;c=((i=Math.imul(f,F))+(o>>>13)|0)+(mt>>>26)|0,mt&=67108863,r=Math.imul(p,J),o=(o=Math.imul(p,F))+Math.imul(g,J)|0,i=Math.imul(g,F);var vt=(c+(r=r+Math.imul(h,W)|0)|0)+((8191&(o=(o=o+Math.imul(h,z)|0)+Math.imul(f,W)|0))<<13)|0;c=((i=i+Math.imul(f,z)|0)+(o>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(v,J),o=(o=Math.imul(v,F))+Math.imul(_,J)|0,i=Math.imul(_,F),r=r+Math.imul(p,W)|0,o=(o=o+Math.imul(p,z)|0)+Math.imul(g,W)|0,i=i+Math.imul(g,z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(o=(o=o+Math.imul(h,V)|0)+Math.imul(f,$)|0))<<13)|0;c=((i=i+Math.imul(f,V)|0)+(o>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(w,J),o=(o=Math.imul(w,F))+Math.imul(b,J)|0,i=Math.imul(b,F),r=r+Math.imul(v,W)|0,o=(o=o+Math.imul(v,z)|0)+Math.imul(_,W)|0,i=i+Math.imul(_,z)|0,r=r+Math.imul(p,$)|0,o=(o=o+Math.imul(p,V)|0)+Math.imul(g,$)|0,i=i+Math.imul(g,V)|0;var yt=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(o=(o=o+Math.imul(h,Z)|0)+Math.imul(f,Q)|0))<<13)|0;c=((i=i+Math.imul(f,Z)|0)+(o>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(E,J),o=(o=Math.imul(E,F))+Math.imul(x,J)|0,i=Math.imul(x,F),r=r+Math.imul(w,W)|0,o=(o=o+Math.imul(w,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,r=r+Math.imul(v,$)|0,o=(o=o+Math.imul(v,V)|0)+Math.imul(_,$)|0,i=i+Math.imul(_,V)|0,r=r+Math.imul(p,Q)|0,o=(o=o+Math.imul(p,Z)|0)+Math.imul(g,Q)|0,i=i+Math.imul(g,Z)|0;var wt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(o=(o=o+Math.imul(h,tt)|0)+Math.imul(f,G)|0))<<13)|0;c=((i=i+Math.imul(f,tt)|0)+(o>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(S,J),o=(o=Math.imul(S,F))+Math.imul(k,J)|0,i=Math.imul(k,F),r=r+Math.imul(E,W)|0,o=(o=o+Math.imul(E,z)|0)+Math.imul(x,W)|0,i=i+Math.imul(x,z)|0,r=r+Math.imul(w,$)|0,o=(o=o+Math.imul(w,V)|0)+Math.imul(b,$)|0,i=i+Math.imul(b,V)|0,r=r+Math.imul(v,Q)|0,o=(o=o+Math.imul(v,Z)|0)+Math.imul(_,Q)|0,i=i+Math.imul(_,Z)|0,r=r+Math.imul(p,G)|0,o=(o=o+Math.imul(p,tt)|0)+Math.imul(g,G)|0,i=i+Math.imul(g,tt)|0;var bt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(o=(o=o+Math.imul(h,rt)|0)+Math.imul(f,nt)|0))<<13)|0;c=((i=i+Math.imul(f,rt)|0)+(o>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(C,J),o=(o=Math.imul(C,F))+Math.imul(O,J)|0,i=Math.imul(O,F),r=r+Math.imul(S,W)|0,o=(o=o+Math.imul(S,z)|0)+Math.imul(k,W)|0,i=i+Math.imul(k,z)|0,r=r+Math.imul(E,$)|0,o=(o=o+Math.imul(E,V)|0)+Math.imul(x,$)|0,i=i+Math.imul(x,V)|0,r=r+Math.imul(w,Q)|0,o=(o=o+Math.imul(w,Z)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Z)|0,r=r+Math.imul(v,G)|0,o=(o=o+Math.imul(v,tt)|0)+Math.imul(_,G)|0,i=i+Math.imul(_,tt)|0,r=r+Math.imul(p,nt)|0,o=(o=o+Math.imul(p,rt)|0)+Math.imul(g,nt)|0,i=i+Math.imul(g,rt)|0;var Mt=(c+(r=r+Math.imul(h,it)|0)|0)+((8191&(o=(o=o+Math.imul(h,st)|0)+Math.imul(f,it)|0))<<13)|0;c=((i=i+Math.imul(f,st)|0)+(o>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,J),o=(o=Math.imul(I,F))+Math.imul(P,J)|0,i=Math.imul(P,F),r=r+Math.imul(C,W)|0,o=(o=o+Math.imul(C,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,r=r+Math.imul(S,$)|0,o=(o=o+Math.imul(S,V)|0)+Math.imul(k,$)|0,i=i+Math.imul(k,V)|0,r=r+Math.imul(E,Q)|0,o=(o=o+Math.imul(E,Z)|0)+Math.imul(x,Q)|0,i=i+Math.imul(x,Z)|0,r=r+Math.imul(w,G)|0,o=(o=o+Math.imul(w,tt)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,tt)|0,r=r+Math.imul(v,nt)|0,o=(o=o+Math.imul(v,rt)|0)+Math.imul(_,nt)|0,i=i+Math.imul(_,rt)|0,r=r+Math.imul(p,it)|0,o=(o=o+Math.imul(p,st)|0)+Math.imul(g,it)|0,i=i+Math.imul(g,st)|0;var Et=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(o=(o=o+Math.imul(h,ct)|0)+Math.imul(f,ut)|0))<<13)|0;c=((i=i+Math.imul(f,ct)|0)+(o>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(L,J),o=(o=Math.imul(L,F))+Math.imul(N,J)|0,i=Math.imul(N,F),r=r+Math.imul(I,W)|0,o=(o=o+Math.imul(I,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,r=r+Math.imul(C,$)|0,o=(o=o+Math.imul(C,V)|0)+Math.imul(O,$)|0,i=i+Math.imul(O,V)|0,r=r+Math.imul(S,Q)|0,o=(o=o+Math.imul(S,Z)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,Z)|0,r=r+Math.imul(E,G)|0,o=(o=o+Math.imul(E,tt)|0)+Math.imul(x,G)|0,i=i+Math.imul(x,tt)|0,r=r+Math.imul(w,nt)|0,o=(o=o+Math.imul(w,rt)|0)+Math.imul(b,nt)|0,i=i+Math.imul(b,rt)|0,r=r+Math.imul(v,it)|0,o=(o=o+Math.imul(v,st)|0)+Math.imul(_,it)|0,i=i+Math.imul(_,st)|0,r=r+Math.imul(p,ut)|0,o=(o=o+Math.imul(p,ct)|0)+Math.imul(g,ut)|0,i=i+Math.imul(g,ct)|0;var xt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(o=(o=o+Math.imul(h,ft)|0)+Math.imul(f,ht)|0))<<13)|0;c=((i=i+Math.imul(f,ft)|0)+(o>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(U,J),o=(o=Math.imul(U,F))+Math.imul(q,J)|0,i=Math.imul(q,F),r=r+Math.imul(L,W)|0,o=(o=o+Math.imul(L,z)|0)+Math.imul(N,W)|0,i=i+Math.imul(N,z)|0,r=r+Math.imul(I,$)|0,o=(o=o+Math.imul(I,V)|0)+Math.imul(P,$)|0,i=i+Math.imul(P,V)|0,r=r+Math.imul(C,Q)|0,o=(o=o+Math.imul(C,Z)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Z)|0,r=r+Math.imul(S,G)|0,o=(o=o+Math.imul(S,tt)|0)+Math.imul(k,G)|0,i=i+Math.imul(k,tt)|0,r=r+Math.imul(E,nt)|0,o=(o=o+Math.imul(E,rt)|0)+Math.imul(x,nt)|0,i=i+Math.imul(x,rt)|0,r=r+Math.imul(w,it)|0,o=(o=o+Math.imul(w,st)|0)+Math.imul(b,it)|0,i=i+Math.imul(b,st)|0,r=r+Math.imul(v,ut)|0,o=(o=o+Math.imul(v,ct)|0)+Math.imul(_,ut)|0,i=i+Math.imul(_,ct)|0,r=r+Math.imul(p,ht)|0,o=(o=o+Math.imul(p,ft)|0)+Math.imul(g,ht)|0,i=i+Math.imul(g,ft)|0;var Rt=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(o=(o=o+Math.imul(h,gt)|0)+Math.imul(f,pt)|0))<<13)|0;c=((i=i+Math.imul(f,gt)|0)+(o>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(U,W),o=(o=Math.imul(U,z))+Math.imul(q,W)|0,i=Math.imul(q,z),r=r+Math.imul(L,$)|0,o=(o=o+Math.imul(L,V)|0)+Math.imul(N,$)|0,i=i+Math.imul(N,V)|0,r=r+Math.imul(I,Q)|0,o=(o=o+Math.imul(I,Z)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Z)|0,r=r+Math.imul(C,G)|0,o=(o=o+Math.imul(C,tt)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,tt)|0,r=r+Math.imul(S,nt)|0,o=(o=o+Math.imul(S,rt)|0)+Math.imul(k,nt)|0,i=i+Math.imul(k,rt)|0,r=r+Math.imul(E,it)|0,o=(o=o+Math.imul(E,st)|0)+Math.imul(x,it)|0,i=i+Math.imul(x,st)|0,r=r+Math.imul(w,ut)|0,o=(o=o+Math.imul(w,ct)|0)+Math.imul(b,ut)|0,i=i+Math.imul(b,ct)|0,r=r+Math.imul(v,ht)|0,o=(o=o+Math.imul(v,ft)|0)+Math.imul(_,ht)|0,i=i+Math.imul(_,ft)|0;var St=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(o=(o=o+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;c=((i=i+Math.imul(g,gt)|0)+(o>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(U,$),o=(o=Math.imul(U,V))+Math.imul(q,$)|0,i=Math.imul(q,V),r=r+Math.imul(L,Q)|0,o=(o=o+Math.imul(L,Z)|0)+Math.imul(N,Q)|0,i=i+Math.imul(N,Z)|0,r=r+Math.imul(I,G)|0,o=(o=o+Math.imul(I,tt)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,tt)|0,r=r+Math.imul(C,nt)|0,o=(o=o+Math.imul(C,rt)|0)+Math.imul(O,nt)|0,i=i+Math.imul(O,rt)|0,r=r+Math.imul(S,it)|0,o=(o=o+Math.imul(S,st)|0)+Math.imul(k,it)|0,i=i+Math.imul(k,st)|0,r=r+Math.imul(E,ut)|0,o=(o=o+Math.imul(E,ct)|0)+Math.imul(x,ut)|0,i=i+Math.imul(x,ct)|0,r=r+Math.imul(w,ht)|0,o=(o=o+Math.imul(w,ft)|0)+Math.imul(b,ht)|0,i=i+Math.imul(b,ft)|0;var kt=(c+(r=r+Math.imul(v,pt)|0)|0)+((8191&(o=(o=o+Math.imul(v,gt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((i=i+Math.imul(_,gt)|0)+(o>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(U,Q),o=(o=Math.imul(U,Z))+Math.imul(q,Q)|0,i=Math.imul(q,Z),r=r+Math.imul(L,G)|0,o=(o=o+Math.imul(L,tt)|0)+Math.imul(N,G)|0,i=i+Math.imul(N,tt)|0,r=r+Math.imul(I,nt)|0,o=(o=o+Math.imul(I,rt)|0)+Math.imul(P,nt)|0,i=i+Math.imul(P,rt)|0,r=r+Math.imul(C,it)|0,o=(o=o+Math.imul(C,st)|0)+Math.imul(O,it)|0,i=i+Math.imul(O,st)|0,r=r+Math.imul(S,ut)|0,o=(o=o+Math.imul(S,ct)|0)+Math.imul(k,ut)|0,i=i+Math.imul(k,ct)|0,r=r+Math.imul(E,ht)|0,o=(o=o+Math.imul(E,ft)|0)+Math.imul(x,ht)|0,i=i+Math.imul(x,ft)|0;var At=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(o=(o=o+Math.imul(w,gt)|0)+Math.imul(b,pt)|0))<<13)|0;c=((i=i+Math.imul(b,gt)|0)+(o>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(U,G),o=(o=Math.imul(U,tt))+Math.imul(q,G)|0,i=Math.imul(q,tt),r=r+Math.imul(L,nt)|0,o=(o=o+Math.imul(L,rt)|0)+Math.imul(N,nt)|0,i=i+Math.imul(N,rt)|0,r=r+Math.imul(I,it)|0,o=(o=o+Math.imul(I,st)|0)+Math.imul(P,it)|0,i=i+Math.imul(P,st)|0,r=r+Math.imul(C,ut)|0,o=(o=o+Math.imul(C,ct)|0)+Math.imul(O,ut)|0,i=i+Math.imul(O,ct)|0,r=r+Math.imul(S,ht)|0,o=(o=o+Math.imul(S,ft)|0)+Math.imul(k,ht)|0,i=i+Math.imul(k,ft)|0;var Ct=(c+(r=r+Math.imul(E,pt)|0)|0)+((8191&(o=(o=o+Math.imul(E,gt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((i=i+Math.imul(x,gt)|0)+(o>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(U,nt),o=(o=Math.imul(U,rt))+Math.imul(q,nt)|0,i=Math.imul(q,rt),r=r+Math.imul(L,it)|0,o=(o=o+Math.imul(L,st)|0)+Math.imul(N,it)|0,i=i+Math.imul(N,st)|0,r=r+Math.imul(I,ut)|0,o=(o=o+Math.imul(I,ct)|0)+Math.imul(P,ut)|0,i=i+Math.imul(P,ct)|0,r=r+Math.imul(C,ht)|0,o=(o=o+Math.imul(C,ft)|0)+Math.imul(O,ht)|0,i=i+Math.imul(O,ft)|0;var Ot=(c+(r=r+Math.imul(S,pt)|0)|0)+((8191&(o=(o=o+Math.imul(S,gt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((i=i+Math.imul(k,gt)|0)+(o>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(U,it),o=(o=Math.imul(U,st))+Math.imul(q,it)|0,i=Math.imul(q,st),r=r+Math.imul(L,ut)|0,o=(o=o+Math.imul(L,ct)|0)+Math.imul(N,ut)|0,i=i+Math.imul(N,ct)|0,r=r+Math.imul(I,ht)|0,o=(o=o+Math.imul(I,ft)|0)+Math.imul(P,ht)|0,i=i+Math.imul(P,ft)|0;var Tt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(o=(o=o+Math.imul(C,gt)|0)+Math.imul(O,pt)|0))<<13)|0;c=((i=i+Math.imul(O,gt)|0)+(o>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(U,ut),o=(o=Math.imul(U,ct))+Math.imul(q,ut)|0,i=Math.imul(q,ct),r=r+Math.imul(L,ht)|0,o=(o=o+Math.imul(L,ft)|0)+Math.imul(N,ht)|0,i=i+Math.imul(N,ft)|0;var It=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(o=(o=o+Math.imul(I,gt)|0)+Math.imul(P,pt)|0))<<13)|0;c=((i=i+Math.imul(P,gt)|0)+(o>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(U,ht),o=(o=Math.imul(U,ft))+Math.imul(q,ht)|0,i=Math.imul(q,ft);var Pt=(c+(r=r+Math.imul(L,pt)|0)|0)+((8191&(o=(o=o+Math.imul(L,gt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((i=i+Math.imul(N,gt)|0)+(o>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Bt=(c+(r=Math.imul(U,pt))|0)+((8191&(o=(o=Math.imul(U,gt))+Math.imul(q,pt)|0))<<13)|0;return c=((i=Math.imul(q,gt))+(o>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=mt,u[1]=vt,u[2]=_t,u[3]=yt,u[4]=wt,u[5]=bt,u[6]=Mt,u[7]=Et,u[8]=xt,u[9]=Rt,u[10]=St,u[11]=kt,u[12]=At,u[13]=Ct,u[14]=Ot,u[15]=Tt,u[16]=It,u[17]=Pt,u[18]=Bt,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new g).mulp(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(d=f),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):n<63?f(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,o=0,i=0;i<n.length-1;i++){var s=o;o=0;for(var a=67108863&r,u=Math.min(i,e.length-1),c=Math.max(0,i-t.length+1);c<=u;c++){var l=i-c,h=(0|t.words[l])*(0|e.words[c]),f=67108863&h;a=67108863&(f=f+a|0),o+=(s=(s=s+(h/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}n.words[i]=a,r=s,s=o}return 0!==r?n.words[i]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=i.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},g.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,o=0;o<e;o++)r|=(1&t)<<e-o-1,t>>=1;return r},g.prototype.permute=function(t,e,n,r,o,i){for(var s=0;s<i;s++)r[s]=e[t[s]],o[s]=n[t[s]]},g.prototype.transform=function(t,e,n,r,o,i){this.permute(i,t,e,n,r,o);for(var s=1;s<o;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),l=0;l<o;l+=a)for(var h=u,f=c,d=0;d<s;d++){var p=n[l+d],g=r[l+d],m=n[l+d+s],v=r[l+d+s],_=h*m-f*v;v=h*v+f*m,m=_,n[l+d]=p+m,r[l+d]=g+v,n[l+d+s]=p-m,r[l+d+s]=g-v,d!==a&&(_=u*h-c*f,f=u*f+c*h,h=_)}},g.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,o=0;for(n=n/2|0;n;n>>>=1)o++;return 1<<o+1+r},g.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var o=t[r];t[r]=t[n-r-1],t[n-r-1]=o,o=e[r],e[r]=-e[n-r-1],e[n-r-1]=-o}},g.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var o=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&o,n=o<67108864?0:o/67108864|0}return t},g.prototype.convert13b=function(t,e,n,o){for(var i=0,s=0;s<e;s++)i+=0|t[s],n[2*s]=8191&i,i>>>=13,n[2*s+1]=8191&i,i>>>=13;for(s=2*e;s<o;++s)n[s]=0;r(0===i),r(0==(-8192&i))},g.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},g.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),o=this.makeRBT(r),i=this.stub(r),s=new Array(r),a=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),f=n.words;f.length=r,this.convert13b(t.words,t.length,s,r),this.convert13b(e.words,e.length,c,r),this.transform(s,i,a,u,r,o),this.transform(c,i,l,h,r,o);for(var d=0;d<r;d++){var p=a[d]*l[d]-u[d]*h[d];u[d]=a[d]*h[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,r),this.transform(a,u,f,i,r,o),this.conjugate(f,i,r),this.normalize13b(f,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,i=(67108863&o)+(67108863&e);e>>=26,e+=o/67108864|0,e+=i>>>26,this.words[n]=67108863&i}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,o=n%26;e[n]=(t.words[r]&1<<o)>>>o}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,o=(t-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&i,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==o){for(e=this.length-1;e>=0;e--)this.words[e+o]=this.words[e];for(e=0;e<o;e++)this.words[e]=0;this.length+=o}return this.strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var o;r("number"==typeof t&&t>=0),o=e?(e-e%26)/26:0;var i=t%26,s=Math.min((t-i)/26,this.length),a=67108863^67108863>>>i<<i,u=n;if(o-=s,o=Math.max(0,o),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=o);c--){var h=0|this.words[c];this.words[c]=l<<26-i|h>>>i,l=h&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,o=1<<e;return!(this.length<=n)&&!!(this.words[n]&o)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var o=67108863^67108863>>>e<<e;this.words[this.length-1]&=o}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var o,i,s=t.length+n;this._expand(s);var a=0;for(o=0;o<t.length;o++){i=(0|this.words[o+n])+a;var u=(0|t.words[o])*e;a=((i-=67108863&u)>>26)-(u/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)a=(i=(0|this.words[o+n])+a)>>26,this.words[o+n]=67108863&i;if(0===a)return this.strip();for(r(-1===a),a=0,o=0;o<this.length;o++)a=(i=-(0|this.words[o])+a)>>26,this.words[o]=67108863&i;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,s=0|o.words[o.length-1];0!==(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,u=r.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,a&&(a.words[u]=1));for(var h=u-1;h>=0;h--){var f=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(f=Math.min(f/s|0,67108863),r._ishlnsubmul(o,f,h);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=f)}return a&&a.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(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(),n&&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(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),o=t.andln(1),i=n.cmp(r);return i<0||1===o&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(e*n+(0|this.words[o]))%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*e;this.words[n]=o/t|0,e=o%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=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(h)),o.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(c)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,f=1;0==(n.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=e.cmp(n);if(o<0){var i=e;e=n,n=i}else if(0===o||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,o=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,s=n;0!==i&&s<this.length;s++){var a=0|this.words[s];i=(a+=i)>>>26,a&=67108863,this.words[s]=a}return 0!==i&&(this.words[s]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var o=0|this.words[0];e=o===t?0:o<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],o=0|t.words[n];if(r!==o){r<o?e=-1:r>o&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new M(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=i._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 E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},o(_,v),_.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=4194303&o,r=10;r<t.length;r++){var i=0|t.words[r];t.words[r-10]=(4194303&i)<<4|o>>>22,o=i}o>>>=22,t.words[r-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},o(y,v),o(w,v),o(b,v),b.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,o=67108863&r;r>>>=26,t.words[n]=o,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new y;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return m[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.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")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}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 i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var v=this.pow(h,new i(1).iushln(p-m-1));f=f.redMul(v),h=v.redSqr(),d=d.redMul(h),p=m}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===r&&0===l)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},o(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).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)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(61)(t))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=a(f);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";var r=n(33);n.o(r,"IJsonRpcConnection")&&n.d(e,"IJsonRpcConnection",(function(){return r.IJsonRpcConnection})),n.o(r,"IJsonRpcProvider")&&n.d(e,"IJsonRpcProvider",(function(){return r.IJsonRpcProvider})),n.o(r,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return r.isHttpUrl})),n.o(r,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return r.isJsonRpcError})),n.o(r,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return r.isJsonRpcResponse}));n(14);var o=n(34);n.d(e,"IJsonRpcConnection",(function(){return o.a})),n.d(e,"IJsonRpcProvider",(function(){return o.b}));var i=n(35);n.o(i,"isHttpUrl")&&n.d(e,"isHttpUrl",(function(){return i.isHttpUrl})),n.o(i,"isJsonRpcError")&&n.d(e,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcResponse")&&n.d(e,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse}))},function(t,e,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(n,r){function o(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&v(t,"error",e,n)}(t,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var o,i,s,a;if(c(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),s=i[e]),void 0===s)s=i[e]=n,++t._eventsCount;else if("function"==typeof s?s=i[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=l(t))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=f.bind(r);return o.listener=n,r.wrapFn=o,o}function p(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(o):m(o,o.length)}function g(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function m(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function v(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){r.once&&t.removeEventListener(e,o),n(i)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,e);else{var c=u.length,l=m(u,c);for(n=0;n<c;++n)i(l[n],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return c(e),this.on(t,d(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,d(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,o,i,s;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===e||n[i].listener===e){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,o),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";(function(t){
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|
|
@@ -30,4 +30,4 @@ and limitations under the License.
|
|
|
30
30
|
***************************************************************************** */
|
|
31
31
|
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function s(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&(n[r[o]]=t[r[o]])}return n}function a(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function u(t,e){return function(n,r){e(n,r,t)}}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(s,a)}u((r=r.apply(t,e||[])).next())}))}function h(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function f(t,e){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}function d(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function p(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function g(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(p(arguments[e]));return t}function m(t){return this instanceof m?(this.v=t,this):new m(t)}function v(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(t,e||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){o[t]&&(r[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=o[t](e)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),i.shift(),i.length&&a(i[0][0],i[0][1])}}function _(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,o){e[r]=t[r]?function(e){return(n=!n)?{value:m(t[r](e)),done:"return"===r}:o?o(e):e}:o}}function y(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=d(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function w(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function b(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function M(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";(function(t){function n(){return(null==t?void 0:t.crypto)||(null==t?void 0:t.msCrypto)||{}}function r(){const t=n();return t.subtle||t.webkitSubtle}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowserCryptoAvailable=e.getSubtleCrypto=e.getBrowerCrypto=void 0,e.getBrowerCrypto=n,e.getSubtleCrypto=r,e.isBrowserCryptoAvailable=function(){return!!n()&&!!r()}}).call(this,n(17))},function(t,e,n){"use strict";(function(t){function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function r(){return void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isNode=e.isReactNative=void 0,e.isReactNative=n,e.isNode=r,e.isBrowser=function(){return!n()&&!r()}}).call(this,n(18))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),s=r[0],a=r[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),l=0,h=a>0?s-4:s;for(n=0;n<h;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===a&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,u[l++]=255&e);1===a&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=0,a=n-o;s<a;s+=16383)i.push(l(t,s,s+16383>a?a:s+16383));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],o[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,n){for(var o,i,s=[],a=e;a<n;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){
|
|
32
32
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
33
|
-
e.read=function(t,e,n,r,o){var i,s,a=8*o-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?o-1:0,f=n?-1:1,d=t[e+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+t[e+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=c}return(d?-1:1)*s*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var s,a,u,c=8*i-o-1,l=(1<<c)-1,h=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[n+d]=255&s,d+=p,s/=256,c-=8);t[n+d-p]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function s(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=s(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),a=0;a<i.length;a++){var u=i[a];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}},function(t,e,n){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(t,e,n){var r=n(72),o=n(73),i=n(90),s=n(91);function a(t,e,n,i,s){var a=[].slice.call(arguments,1),u=a.length,c="function"==typeof a[u-1];if(!c&&!r())throw new Error("Callback required as last argument");if(!c){if(u<1)throw new Error("Too few arguments provided");return 1===u?(n=e,e=i=void 0):2!==u||e.getContext||(i=n,n=e,e=void 0),new Promise((function(r,s){try{var a=o.create(n,i);r(t(a,e,i))}catch(t){s(t)}}))}if(u<2)throw new Error("Too few arguments provided");2===u?(s=n,n=e,e=i=void 0):3===u&&(e.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=e,e=void 0));try{var l=o.create(n,i);s(null,t(l,e,i))}catch(t){s(t)}}e.create=o.create,e.toCanvas=a.bind(null,i.render),e.toDataURL=a.bind(null,i.renderToDataURL),e.toString=a.bind(null,(function(t,e,n){return s.render(t,n)}))},function(t,e){t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},function(t,e,n){var r=n(12),o=n(8),i=n(23),s=n(74),a=n(75),u=n(76),c=n(77),l=n(78),h=n(46),f=n(79),d=n(82),p=n(83),g=n(9),m=n(84),v=n(22);function _(t,e,n){var r,o,i=t.size,s=p.getEncodedBits(e,n);for(r=0;r<15;r++)o=1==(s>>r&1),r<6?t.set(r,8,o,!0):r<8?t.set(r+1,8,o,!0):t.set(i-15+r,8,o,!0),r<8?t.set(8,i-r-1,o,!0):r<9?t.set(8,15-r-1+1,o,!0):t.set(8,15-r-1,o,!0);t.set(i-8,8,1,!0)}function y(t,e,n){var i=new s;n.forEach((function(e){i.put(e.mode.bit,4),i.put(e.getLength(),g.getCharCountIndicator(e.mode,t)),e.write(i)}));var a=8*(o.getSymbolTotalCodewords(t)-h.getTotalCodewordsCount(t,e));for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);for(var u=(a-i.getLengthInBits())/8,c=0;c<u;c++)i.put(c%2?17:236,8);return function(t,e,n){for(var i=o.getSymbolTotalCodewords(e),s=h.getTotalCodewordsCount(e,n),a=i-s,u=h.getBlocksCount(e,n),c=u-i%u,l=Math.floor(i/u),d=Math.floor(a/u),p=d+1,g=l-d,m=new f(g),v=0,_=new Array(u),y=new Array(u),w=0,b=r.from(t.buffer),M=0;M<u;M++){var E=M<c?d:p;_[M]=b.slice(v,v+E),y[M]=m.encode(_[M]),v+=E,w=Math.max(w,E)}var x,R,S=r.alloc(i),k=0;for(x=0;x<w;x++)for(R=0;R<u;R++)x<_[R].length&&(S[k++]=_[R][x]);for(x=0;x<g;x++)for(R=0;R<u;R++)S[k++]=y[R][x];return S}(i,t,e)}function w(t,e,n,r){var i;if(v(t))i=m.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");var s=e;if(!s){var h=m.rawSplit(t);s=d.getBestVersionForData(h,n)}i=m.fromString(t,s||40)}var f=d.getBestVersionForData(i,n);if(!f)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<f)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+f+".\n")}else e=f;var p=y(e,n,i),g=o.getSymbolSize(e),w=new a(g);return function(t,e){for(var n=t.size,r=c.getPositions(e),o=0;o<r.length;o++)for(var i=r[o][0],s=r[o][1],a=-1;a<=7;a++)if(!(i+a<=-1||n<=i+a))for(var u=-1;u<=7;u++)s+u<=-1||n<=s+u||(a>=0&&a<=6&&(0===u||6===u)||u>=0&&u<=6&&(0===a||6===a)||a>=2&&a<=4&&u>=2&&u<=4?t.set(i+a,s+u,!0,!0):t.set(i+a,s+u,!1,!0))}(w,e),function(t){for(var e=t.size,n=8;n<e-8;n++){var r=n%2==0;t.set(n,6,r,!0),t.set(6,n,r,!0)}}(w),function(t,e){for(var n=u.getPositions(e),r=0;r<n.length;r++)for(var o=n[r][0],i=n[r][1],s=-2;s<=2;s++)for(var a=-2;a<=2;a++)-2===s||2===s||-2===a||2===a||0===s&&0===a?t.set(o+s,i+a,!0,!0):t.set(o+s,i+a,!1,!0)}(w,e),_(w,n,0),e>=7&&function(t,e){for(var n,r,o,i=t.size,s=d.getEncodedBits(e),a=0;a<18;a++)n=Math.floor(a/3),r=a%3+i-8-3,o=1==(s>>a&1),t.set(n,r,o,!0),t.set(r,n,o,!0)}(w,e),function(t,e){for(var n=t.size,r=-1,o=n-1,i=7,s=0,a=n-1;a>0;a-=2)for(6===a&&a--;;){for(var u=0;u<2;u++)if(!t.isReserved(o,a-u)){var c=!1;s<e.length&&(c=1==(e[s]>>>i&1)),t.set(o,a-u,c),-1===--i&&(s++,i=7)}if((o+=r)<0||n<=o){o-=r,r=-r;break}}}(w,p),isNaN(r)&&(r=l.getBestMask(w,_.bind(null,w,n))),l.applyMask(r,w),_(w,n,r),{modules:w,version:e,errorCorrectionLevel:n,maskPattern:r,segments:i}}e.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");var n,r,s=i.M;return void 0!==e&&(s=i.from(e.errorCorrectionLevel,i.M),n=d.from(e.version),r=l.from(e.maskPattern),e.toSJISFunc&&o.setToSJISFunction(e.toSJISFunc)),w(t,n,s,r)}},function(t,e){function n(){this.buffer=[],this.length=0}n.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=n},function(t,e,n){var r=n(12);function o(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=r.alloc(t*t),this.reservedBit=r.alloc(t*t)}o.prototype.set=function(t,e,n,r){var o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)},o.prototype.get=function(t,e){return this.data[t*this.size+e]},o.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},o.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},t.exports=o},function(t,e,n){var r=n(8).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];for(var e=Math.floor(t/7)+2,n=r(t),o=145===n?26:2*Math.ceil((n-13)/(2*e-2)),i=[n-7],s=1;s<e-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){for(var n=[],r=e.getRowColCoords(t),o=r.length,i=0;i<o;i++)for(var s=0;s<o;s++)0===i&&0===s||0===i&&s===o-1||i===o-1&&0===s||n.push([r[i],r[s]]);return n}},function(t,e,n){var r=n(8).getSymbolSize;e.getPositions=function(t){var e=r(t);return[[0,0],[e-7,0],[0,e-7]]}},function(t,e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var n=3,r=3,o=40,i=10;function s(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){for(var e=t.size,r=0,o=0,i=0,s=null,a=null,u=0;u<e;u++){o=i=0,s=a=null;for(var c=0;c<e;c++){var l=t.get(u,c);l===s?o++:(o>=5&&(r+=n+(o-5)),s=l,o=1),(l=t.get(c,u))===a?i++:(i>=5&&(r+=n+(i-5)),a=l,i=1)}o>=5&&(r+=n+(o-5)),i>=5&&(r+=n+(i-5))}return r},e.getPenaltyN2=function(t){for(var e=t.size,n=0,o=0;o<e-1;o++)for(var i=0;i<e-1;i++){var s=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);4!==s&&0!==s||n++}return n*r},e.getPenaltyN3=function(t){for(var e=t.size,n=0,r=0,i=0,s=0;s<e;s++){r=i=0;for(var a=0;a<e;a++)r=r<<1&2047|t.get(s,a),a>=10&&(1488===r||93===r)&&n++,i=i<<1&2047|t.get(a,s),a>=10&&(1488===i||93===i)&&n++}return n*o},e.getPenaltyN4=function(t){for(var e=0,n=t.data.length,r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*i},e.applyMask=function(t,e){for(var n=e.size,r=0;r<n;r++)for(var o=0;o<n;o++)e.isReserved(o,r)||e.xor(o,r,s(t,o,r))},e.getBestMask=function(t,n){for(var r=Object.keys(e.Patterns).length,o=0,i=1/0,s=0;s<r;s++){n(s),e.applyMask(s,t);var a=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),a<i&&(i=a,o=s)}return o}},function(t,e,n){var r=n(12),o=n(80),i=n(21).Buffer;function s(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}s.prototype.initialize=function(t){this.degree=t,this.genPoly=o.generateECPolynomial(this.degree)},s.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");var e=r.alloc(this.degree),n=i.concat([t,e],t.length+this.degree),s=o.mod(n,this.genPoly),a=this.degree-s.length;if(a>0){var u=r.alloc(this.degree);return s.copy(u,a),u}return s},t.exports=s},function(t,e,n){var r=n(12),o=n(81);e.mul=function(t,e){for(var n=r.alloc(t.length+e.length-1),i=0;i<t.length;i++)for(var s=0;s<e.length;s++)n[i+s]^=o.mul(t[i],e[s]);return n},e.mod=function(t,e){for(var n=r.from(t);n.length-e.length>=0;){for(var i=n[0],s=0;s<e.length;s++)n[s]^=o.mul(e[s],i);for(var a=0;a<n.length&&0===n[a];)a++;n=n.slice(a)}return n},e.generateECPolynomial=function(t){for(var n=r.from([1]),i=0;i<t;i++)n=e.mul(n,[1,o.exp(i)]);return n}},function(t,e,n){var r=n(12),o=r.alloc(512),i=r.alloc(256);!function(){for(var t=1,e=0;e<255;e++)o[e]=t,i[t]=e,256&(t<<=1)&&(t^=285);for(e=255;e<512;e++)o[e]=o[e-255]}(),e.log=function(t){if(t<1)throw new Error("log("+t+")");return i[t]},e.exp=function(t){return o[t]},e.mul=function(t,e){return 0===t||0===e?0:o[i[t]+i[e]]}},function(t,e,n){var r=n(8),o=n(46),i=n(23),s=n(9),a=n(47),u=n(22),c=r.getBCHDigit(7973);function l(t,e){return s.getCharCountIndicator(t,e)+4}function h(t,e){var n=0;return t.forEach((function(t){var r=l(t.mode,e);n+=r+t.getBitsLength()})),n}e.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},e.getCapacity=function(t,e,n){if(!a.isValid(t))throw new Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);var i=8*(r.getSymbolTotalCodewords(t)-o.getTotalCodewordsCount(t,e));if(n===s.MIXED)return i;var u=i-l(n,t);switch(n){case s.NUMERIC:return Math.floor(u/10*3);case s.ALPHANUMERIC:return Math.floor(u/11*2);case s.KANJI:return Math.floor(u/13);case s.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,n){var r,o=i.from(n,i.M);if(u(t)){if(t.length>1)return function(t,n){for(var r=1;r<=40;r++){if(h(t,r)<=e.getCapacity(r,n,s.MIXED))return r}}(t,o);if(0===t.length)return 1;r=t[0]}else r=t;return function(t,n,r){for(var o=1;o<=40;o++)if(n<=e.getCapacity(o,r,t))return o}(r.mode,r.getLength(),o)},e.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");for(var e=t<<12;r.getBCHDigit(e)-c>=0;)e^=7973<<r.getBCHDigit(e)-c;return t<<12|e}},function(t,e,n){var r=n(8),o=r.getBCHDigit(1335);e.getEncodedBits=function(t,e){for(var n=t.bit<<3|e,i=n<<10;r.getBCHDigit(i)-o>=0;)i^=1335<<r.getBCHDigit(i)-o;return 21522^(n<<10|i)}},function(t,e,n){var r=n(9),o=n(85),i=n(86),s=n(87),a=n(88),u=n(48),c=n(8),l=n(89);function h(t){return unescape(encodeURIComponent(t)).length}function f(t,e,n){for(var r,o=[];null!==(r=t.exec(n));)o.push({data:r[0],index:r.index,mode:e,length:r[0].length});return o}function d(t){var e,n,o=f(u.NUMERIC,r.NUMERIC,t),i=f(u.ALPHANUMERIC,r.ALPHANUMERIC,t);return c.isKanjiModeEnabled()?(e=f(u.BYTE,r.BYTE,t),n=f(u.KANJI,r.KANJI,t)):(e=f(u.BYTE_KANJI,r.BYTE,t),n=[]),o.concat(i,e,n).sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function p(t,e){switch(e){case r.NUMERIC:return o.getBitsLength(t);case r.ALPHANUMERIC:return i.getBitsLength(t);case r.KANJI:return a.getBitsLength(t);case r.BYTE:return s.getBitsLength(t)}}function g(t,e){var n,u=r.getBestModeForData(t);if((n=r.from(e,u))!==r.BYTE&&n.bit<u.bit)throw new Error('"'+t+'" cannot be encoded with mode '+r.toString(n)+".\n Suggested mode is: "+r.toString(u));switch(n!==r.KANJI||c.isKanjiModeEnabled()||(n=r.BYTE),n){case r.NUMERIC:return new o(t);case r.ALPHANUMERIC:return new i(t);case r.KANJI:return new a(t);case r.BYTE:return new s(t)}}e.fromArray=function(t){return t.reduce((function(t,e){return"string"==typeof e?t.push(g(e,null)):e.data&&t.push(g(e.data,e.mode)),t}),[])},e.fromString=function(t,n){for(var o=function(t,e){for(var n={},o={start:{}},i=["start"],s=0;s<t.length;s++){for(var a=t[s],u=[],c=0;c<a.length;c++){var l=a[c],h=""+s+c;u.push(h),n[h]={node:l,lastCount:0},o[h]={};for(var f=0;f<i.length;f++){var d=i[f];n[d]&&n[d].node.mode===l.mode?(o[d][h]=p(n[d].lastCount+l.length,l.mode)-p(n[d].lastCount,l.mode),n[d].lastCount+=l.length):(n[d]&&(n[d].lastCount=l.length),o[d][h]=p(l.length,l.mode)+4+r.getCharCountIndicator(l.mode,e))}}i=u}for(f=0;f<i.length;f++)o[i[f]].end=0;return{map:o,table:n}}(function(t){for(var e=[],n=0;n<t.length;n++){var o=t[n];switch(o.mode){case r.NUMERIC:e.push([o,{data:o.data,mode:r.ALPHANUMERIC,length:o.length},{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.ALPHANUMERIC:e.push([o,{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.KANJI:e.push([o,{data:o.data,mode:r.BYTE,length:h(o.data)}]);break;case r.BYTE:e.push([{data:o.data,mode:r.BYTE,length:h(o.data)}])}}return e}(d(t,c.isKanjiModeEnabled())),n),i=l.find_path(o.map,"start","end"),s=[],a=1;a<i.length-1;a++)s.push(o.table[i[a]].node);return e.fromArray(function(t){return t.reduce((function(t,e){var n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(s))},e.rawSplit=function(t){return e.fromArray(d(t,c.isKanjiModeEnabled()))}},function(t,e,n){var r=n(9);function o(t){this.mode=r.NUMERIC,this.data=t.toString()}o.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){var e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);var o=this.data.length-e;o>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*o+1))},t.exports=o},function(t,e,n){var r=n(9),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(t){this.mode=r.ALPHANUMERIC,this.data=t}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){var e;for(e=0;e+2<=this.data.length;e+=2){var n=45*o.indexOf(this.data[e]);n+=o.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(o.indexOf(this.data[e]),6)},t.exports=i},function(t,e,n){var r=n(12),o=n(9);function i(t){this.mode=o.BYTE,this.data=r.from(t)}i.getBitsLength=function(t){return 8*t},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){for(var e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)},t.exports=i},function(t,e,n){var r=n(9),o=n(8);function i(t){this.mode=r.KANJI,this.data=t}i.getBitsLength=function(t){return 13*t},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var n=o.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}},t.exports=i},function(t,e,n){"use strict";var r={single_source_shortest_paths:function(t,e,n){var o={},i={};i[e]=0;var s,a,u,c,l,h,f,d=r.PriorityQueue.make();for(d.push(e,0);!d.empty();)for(u in a=(s=d.pop()).value,c=s.cost,l=t[a]||{})l.hasOwnProperty(u)&&(h=c+l[u],f=i[u],(void 0===i[u]||f>h)&&(i[u]=h,d.push(u,h),o[u]=a));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,e,n){var o=r.single_source_shortest_paths(t,e,n);return r.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e,n=r.PriorityQueue,o={};for(e in t=t||{},n)n.hasOwnProperty(e)&&(o[e]=n[e]);return o.queue=[],o.sorter=t.sorter||n.default_sorter,o},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=r},function(t,e,n){var r=n(49);e.render=function(t,e,n){var o=n,i=e;void 0!==o||e&&e.getContext||(o=e,e=void 0),e||(i=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),o=r.getOptions(o);var s=r.getImageWidth(t.modules.size,o),a=i.getContext("2d"),u=a.createImageData(s,s);return r.qrToImageData(u.data,t,o),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(a,i,s),a.putImageData(u,0,0),i},e.renderToDataURL=function(t,n,r){var o=r;void 0!==o||n&&n.getContext||(o=n,n=void 0),o||(o={});var i=e.render(t,n,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}},function(t,e,n){var r=n(49);function o(t,e){var n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function i(t,e,n){var r=t+e;return void 0!==n&&(r+=" "+n),r}e.render=function(t,e,n){var s=r.getOptions(e),a=t.modules.size,u=t.modules.data,c=a+2*s.margin,l=s.color.light.a?"<path "+o(s.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",h="<path "+o(s.color.dark,"stroke")+' d="'+function(t,e,n){for(var r="",o=0,s=!1,a=0,u=0;u<t.length;u++){var c=Math.floor(u%e),l=Math.floor(u/e);c||s||(s=!0),t[u]?(a++,u>0&&c>0&&t[u-1]||(r+=s?i("M",c+n,.5+l+n):i("m",o,0),o=0,s=!1),c+1<e&&t[u+1]||(r+=i("h",a),a=0)):o++}return r}(u,a,s.margin)+'"/>',f='viewBox="0 0 '+c+" "+c+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+f+' shape-rendering="crispEdges">'+l+h+"</svg>\n";return"function"==typeof n&&n(null,d),d}},function(t,e,n){"use strict";var r=n(93),o={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var n,i,s,a,u,c,l=!1;e||(e={}),n=e.debug||!1;try{if(s=r(),a=document.createRange(),u=document.getSelection(),(c=document.createElement("span")).textContent=t,c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(r){if(r.stopPropagation(),e.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=o[e.format]||o.default;window.clipboardData.setData(i,t)}else r.clipboardData.clearData(),r.clipboardData.setData(e.format,t);e.onCopy&&(r.preventDefault(),e.onCopy(r.clipboardData))})),document.body.appendChild(c),a.selectNodeContents(c),u.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),l=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),i=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,t)}}finally{u&&("function"==typeof u.removeRange?u.removeRange(a):u.removeAllRanges()),c&&document.body.removeChild(c),s()}return l}},function(t,e){t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],r=0;r<t.rangeCount;r++)n.push(t.getRangeAt(r));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null}return t.removeAllRanges(),function(){"Caret"===t.type&&t.removeAllRanges(),t.rangeCount||n.forEach((function(e){t.addRange(e)})),e&&e.focus()}}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"generateKey",(function(){return g})),n.d(r,"verifyHmac",(function(){return m})),n.d(r,"encrypt",(function(){return v})),n.d(r,"decrypt",(function(){return _}));var o=n(25),i=n.n(o),s=n(1),a=n(54);var u=class{constructor(){this._eventEmitters=[]}subscribe(t){this._eventEmitters.push(t)}unsubscribe(t){this._eventEmitters=this._eventEmitters.filter(e=>e.event!==t)}trigger(t){let e,n=[];e=Object(s.isJsonRpcRequest)(t)?t.method:Object(s.isJsonRpcResponseSuccess)(t)||Object(s.isJsonRpcResponseError)(t)?"response:"+t.id:Object(s.isInternalEvent)(t)?t.event:"",e&&(n=this._eventEmitters.filter(t=>t.event===e)),n&&n.length||Object(s.isReservedEvent)(e)||Object(s.isInternalEvent)(e)||(n=this._eventEmitters.filter(t=>"call_request"===t.event)),n.forEach(e=>{if(Object(s.isJsonRpcResponseError)(t)){const n=new Error(t.error.message);e.callback(n,null)}else e.callback(null,t)})}};var c=class{constructor(t="walletconnect"){this.storageId=t}getSession(){let t=null;const e=Object(s.getLocal)(this.storageId);return e&&Object(s.isWalletConnectSession)(e)&&(t=e),t}setSession(t){return Object(s.setLocal)(this.storageId,t),t}removeSession(){Object(s.removeLocal)(this.storageId)}};const l="abcdefghijklmnopqrstuvwxyz0123456789".split("").map(t=>`https://${t}.bridge.walletconnect.org`);function h(){return l[Math.floor(Math.random()*l.length)]}var f=class{constructor(t){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new u,this._clientMeta=Object(s.getClientMeta)()||t.connectorOpts.clientMeta||null,this._cryptoLib=t.cryptoLib,this._sessionStorage=t.sessionStorage||new c(t.connectorOpts.storageId),this._qrcodeModal=t.connectorOpts.qrcodeModal,this._qrcodeModalOptions=t.connectorOpts.qrcodeModalOptions,this._signingMethods=[...s.signingMethods,...t.connectorOpts.signingMethods||[]],!t.connectorOpts.bridge&&!t.connectorOpts.uri&&!t.connectorOpts.session)throw new Error("Missing one of the required parameters: bridge / uri / session");var e;t.connectorOpts.bridge&&(this.bridge=function(t){return"walletconnect.org"===function(t){return function(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}(t).split(".").slice(-2).join(".")}(t)}(e=t.connectorOpts.bridge)?h():e),t.connectorOpts.uri&&(this.uri=t.connectorOpts.uri);const n=t.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=t.transport||new a.a({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),t.connectorOpts.uri&&this._subscribeToSessionRequest(),t.pushServerOpts&&this._registerPushServer(t.pushServerOpts)}set bridge(t){t&&(this._bridge=t)}get bridge(){return this._bridge}set key(t){if(!t)return;const e=Object(s.convertHexToArrayBuffer)(t);this._key=e}get key(){if(this._key){return Object(s.convertArrayBufferToHex)(this._key,!0)}return""}set clientId(t){t&&(this._clientId=t)}get clientId(){let t=this._clientId;return t||(t=this._clientId=Object(s.uuid)()),this._clientId}set peerId(t){t&&(this._peerId=t)}get peerId(){return this._peerId}set clientMeta(t){}get clientMeta(){let t=this._clientMeta;return t||(t=this._clientMeta=Object(s.getClientMeta)()),t}set peerMeta(t){this._peerMeta=t}get peerMeta(){return this._peerMeta}set handshakeTopic(t){t&&(this._handshakeTopic=t)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(t){t&&(this._handshakeId=t)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(t){if(!t)return;const{handshakeTopic:e,bridge:n,key:r}=this._parseUri(t);this.handshakeTopic=e,this.bridge=n,this.key=r}set chainId(t){this._chainId=t}get chainId(){return this._chainId}set networkId(t){this._networkId=t}get networkId(){return this._networkId}set accounts(t){this._accounts=t}get accounts(){return this._accounts}set rpcUrl(t){this._rpcUrl=t}get rpcUrl(){return this._rpcUrl}set connected(t){}get connected(){return this._connected}set pending(t){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(t){t&&(this._connected=t.connected,this.accounts=t.accounts,this.chainId=t.chainId,this.bridge=t.bridge,this.key=t.key,this.clientId=t.clientId,this.clientMeta=t.clientMeta,this.peerId=t.peerId,this.peerMeta=t.peerMeta,this.handshakeId=t.handshakeId,this.handshakeTopic=t.handshakeTopic)}on(t,e){const n={event:t,callback:e};this._eventManager.subscribe(n)}off(t){this._eventManager.unsubscribe(t)}async createInstantRequest(t){this._key=await this._generateKey();const e=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(t)}]});this.handshakeId=e.id,this.handshakeTopic=Object(s.uuid)(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error("User close QRCode Modal")});const n=()=>{this.killSession()};try{const t=await this._sendCallRequest(e);return t&&n(),t}catch(t){throw n(),t}}async connect(t){if(!this._qrcodeModal)throw new Error("QRCode Modal not provided");return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(t),new Promise(async(t,e)=>{this.on("modal_closed",()=>e(new Error("User close QRCode Modal"))),this.on("connect",(n,r)=>{if(n)return e(n);t(r.params[0])})}))}async createSession(t){if(this._connected)throw new Error("Session currently connected");if(this.pending)return;this._key=await this._generateKey();const e=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:t&&t.chainId?t.chainId:null}]});this.handshakeId=e.id,this.handshakeTopic=Object(s.uuid)(),this._sendSessionRequest(e,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(t){if(this._connected)throw new Error("Session currently connected");this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},n={id:this.handshakeId,jsonrpc:"2.0",result:e};this._sendResponse(n),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(t){if(this._connected)throw new Error("Session currently connected");const e=t&&t.message?t.message:"Session Rejected",n=this._formatResponse({id:this.handshakeId,error:{message:e}});this._sendResponse(n),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession()}updateSession(t){if(!this._connected)throw new Error("Session currently disconnected");this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},n=this._formatRequest({method:"wc_sessionUpdate",params:[e]});this._sendSessionRequest(n,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(t){const e=t?t.message:"Session Disconnected",n=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(n),this._handleSessionDisconnect(e)}async sendTransaction(t){if(!this._connected)throw new Error("Session currently disconnected");const e=Object(s.parseTransactionData)(t),n=this._formatRequest({method:"eth_sendTransaction",params:[e]});return await this._sendCallRequest(n)}async signTransaction(t){if(!this._connected)throw new Error("Session currently disconnected");const e=Object(s.parseTransactionData)(t),n=this._formatRequest({method:"eth_signTransaction",params:[e]});return await this._sendCallRequest(n)}async signMessage(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"eth_sign",params:t});return await this._sendCallRequest(e)}async signPersonalMessage(t){if(!this._connected)throw new Error("Session currently disconnected");t=Object(s.parsePersonalSign)(t);const e=this._formatRequest({method:"personal_sign",params:t});return await this._sendCallRequest(e)}async signTypedData(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"eth_signTypedData",params:t});return await this._sendCallRequest(e)}async updateChain(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"wallet_updateChain",params:[t]});return await this._sendCallRequest(e)}unsafeSend(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),new Promise((e,n)=>{this._subscribeToResponse(t.id,(t,r)=>{if(t)n(t);else{if(!r)throw new Error("Missing JSON RPC response");e(r)}})})}async sendCustomRequest(t,e){if(!this._connected)throw new Error("Session currently disconnected");switch(t.method){case"eth_accounts":return this.accounts;case"eth_chainId":return Object(s.convertNumberToHex)(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":t.params&&(t.params[0]=Object(s.parseTransactionData)(t.params[0]));break;case"personal_sign":t.params&&(t.params=Object(s.parsePersonalSign)(t.params))}const n=this._formatRequest(t);return await this._sendCallRequest(n,e)}approveRequest(t){if(!Object(s.isJsonRpcResponseSuccess)(t))throw new Error('JSON-RPC success response must include "result" field');{const e=this._formatResponse(t);this._sendResponse(e)}}rejectRequest(t){if(!Object(s.isJsonRpcResponseError)(t))throw new Error('JSON-RPC error response must include "error" field');{const e=this._formatResponse(t);this._sendResponse(e)}}transportClose(){this._transport.close()}async _sendRequest(t,e){const n=this._formatRequest(t),r=await this._encrypt(n),o=void 0!==(null==e?void 0:e.topic)?e.topic:this.peerId,i=JSON.stringify(r),a=void 0!==(null==e?void 0:e.forcePushNotification)?!e.forcePushNotification:Object(s.isSilentPayload)(n);this._transport.send(i,o,a)}async _sendResponse(t){const e=await this._encrypt(t),n=this.peerId,r=JSON.stringify(e);this._transport.send(r,n,!0)}async _sendSessionRequest(t,e,n){this._sendRequest(t,n),this._subscribeToSessionResponse(t.id,e)}_sendCallRequest(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),this._subscribeToCallResponse(t.id)}_formatRequest(t){if(void 0===t.method)throw new Error('JSON RPC request must have valid "method" value');return{id:void 0===t.id?Object(s.payloadId)():t.id,jsonrpc:"2.0",method:t.method,params:void 0===t.params?[]:t.params}}_formatResponse(t){if(void 0===t.id)throw new Error('JSON RPC request must have valid "id" value');const e={id:t.id,jsonrpc:"2.0"};if(Object(s.isJsonRpcResponseError)(t)){const n=Object(s.formatRpcError)(t.error);return Object.assign(Object.assign(Object.assign({},e),t),{error:n})}if(Object(s.isJsonRpcResponseSuccess)(t)){return Object.assign(Object.assign({},e),t)}throw new Error("JSON RPC response format is invalid")}_handleSessionDisconnect(t){const e=t||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),Object(s.removeLocal)(s.mobileLinkChoiceKey)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(t,e){e&&e.approved?(this._connected?(e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),e.peerId&&!this.peerId&&(this.peerId=e.peerId),e.peerMeta&&!this.peerMeta&&(this.peerMeta=e.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(t)}async _handleIncomingMessages(t){if(![this.clientId,this.handshakeTopic].includes(t.topic))return;let e;try{e=JSON.parse(t.payload)}catch(t){return}const n=await this._decrypt(e);n&&this._eventManager.trigger(n)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(t,e){this.on("response:"+t,e)}_subscribeToSessionResponse(t,e){this._subscribeToResponse(t,(t,n)=>{t?this._handleSessionResponse(t.message):n.result?this._handleSessionResponse(e,n.result):n.error&&n.error.message?this._handleSessionResponse(n.error.message):this._handleSessionResponse(e)})}_subscribeToCallResponse(t){return new Promise((e,n)=>{this._subscribeToResponse(t,(t,r)=>{t?n(t):r.result?e(r.result):r.error&&r.error.message?n(new Error(r.error.message)):n(new Error("JSON RPC response format is invalid"))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(t,e)=>{const{request:n}=e.params[0];if(Object(s.isMobile)()&&this._signingMethods.includes(n.method)){const t=Object(s.getLocal)(s.mobileLinkChoiceKey);t&&(window.location.href=t.href)}}),this.on("wc_sessionRequest",(t,e)=>{t&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:t.toString()}]}),this.handshakeId=e.id,this.peerId=e.params[0].peerId,this.peerMeta=e.params[0].peerMeta;const n=Object.assign(Object.assign({},e),{method:"session_request"});this._eventManager.trigger(n)}),this.on("wc_sessionUpdate",(t,e)=>{t&&this._handleSessionResponse(t.message),this._handleSessionResponse("Session disconnected",e.params[0])})}_initTransport(){this._transport.on("message",t=>this._handleIncomingMessages(t)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(t){const e=Object(s.parseWalletConnectUri)(t);if(e.protocol===this.protocol){if(!e.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const t=e.handshakeTopic;if(!e.bridge)throw Error("Invalid or missing bridge url parameter value");const n=decodeURIComponent(e.bridge);if(!e.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:t,bridge:n,key:e.key}}throw new Error("URI format is invalid")}async _generateKey(){if(this._cryptoLib){return await this._cryptoLib.generateKey()}return null}async _encrypt(t){const e=this._key;if(this._cryptoLib&&e){return await this._cryptoLib.encrypt(t,e)}return null}async _decrypt(t){const e=this._key;if(this._cryptoLib&&e){return await this._cryptoLib.decrypt(t,e)}return null}_getStorageSession(){let t=null;return this._sessionStorage&&(t=this._sessionStorage.getSession()),t}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(t){if(!t.url||"string"!=typeof t.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!t.type||"string"!=typeof t.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!t.token||"string"!=typeof t.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const e={bridge:this.bridge,topic:this.clientId,type:t.type,token:t.token,peerName:"",language:t.language||""};this.on("connect",async(n,r)=>{if(n)throw n;if(t.peerMeta){const t=r.params[0].peerMeta.name;e.peerName=t}try{const n=await fetch(t.url+"/new",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)});if(!(await n.json()).success)throw Error("Failed to register in Push Server")}catch(n){throw Error("Failed to register in Push Server")}})}},d=n(13),p=n(0);async function g(t){const e=(t||256)/8,n=d.randomBytes(e);return Object(s.convertBufferToArrayBuffer)(p.b(n))}async function m(t,e){const n=p.n(t.data),r=p.n(t.iv),o=p.n(t.hmac),i=p.c(o,!1),s=p.j(n,r),a=await d.hmacSha256Sign(e,s),u=p.c(a,!1);return p.x(i)===p.x(u)}async function v(t,e,n){const r=p.f(Object(s.convertArrayBufferToBuffer)(e)),o=n||await g(128),i=p.f(Object(s.convertArrayBufferToBuffer)(o)),a=p.c(i,!1),u=JSON.stringify(t),c=p.z(u),l=await d.aesCbcEncrypt(i,r,c),h=p.c(l,!1),f=p.j(l,i),m=await d.hmacSha256Sign(r,f);return{data:h,hmac:p.c(m,!1),iv:a}}async function _(t,e){const n=p.f(Object(s.convertArrayBufferToBuffer)(e));if(!n)throw new Error("Missing key: required for decryption");if(!await m(t,n))return null;const r=p.n(t.data),o=p.n(t.iv),i=await d.aesCbcDecrypt(o,n,r),a=p.e(i);let u;try{u=JSON.parse(a)}catch(t){return null}return u}var y=class extends f{constructor(t,e){super({cryptoLib:r,connectorOpts:t,pushServerOpts:e})}},w=n(56),b=n.n(w),M=n(19),E=n(5);n.d(e,"SignerConnection",(function(){return x}));class x extends M.IJsonRpcConnection{constructor(t){super(),this.events=new i.a,this.accounts=[],this.chainId=1,this.pending=!1,this.bridge="https://bridge.walletconnect.org",this.qrcode=!0,this.qrcodeModalOptions=void 0,this.opts=t,this.chainId=(null==t?void 0:t.chainId)||this.chainId,this.wc=this.register(t)}get connected(){return void 0!==this.wc&&this.wc.connected}get connecting(){return this.pending}get connector(){return this.wc=this.register(this.opts),this.wc}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t){if(!this.connected)return new Promise((e,n)=>{this.on("error",t=>{n(t)}),this.on("open",()=>{e()}),this.create(t)});this.onOpen()}async close(){void 0!==this.wc&&(this.wc.connected&&this.wc.killSession(),this.onClose())}async send(t){this.wc=this.register(this.opts),this.connected||await this.open(),this.sendPayload(t).then(t=>this.events.emit("payload",t)).catch(e=>this.events.emit("payload",Object(E.formatJsonRpcError)(t.id,e.message)))}register(t){if(this.wc)return this.wc;this.opts=t||this.opts,this.bridge=(null==t?void 0:t.connector)?t.connector.bridge:(null==t?void 0:t.bridge)||"https://bridge.walletconnect.org",this.qrcode=void 0===(null==t?void 0:t.qrcode)||!1!==t.qrcode,this.chainId=void 0!==(null==t?void 0:t.chainId)?t.chainId:this.chainId,this.qrcodeModalOptions=null==t?void 0:t.qrcodeModalOptions;const e={bridge:this.bridge,qrcodeModal:this.qrcode?b.a:void 0,qrcodeModalOptions:this.qrcodeModalOptions,storageId:null==t?void 0:t.storageId,signingMethods:null==t?void 0:t.signingMethods,clientMeta:null==t?void 0:t.clientMeta};if(this.wc=void 0!==(null==t?void 0:t.connector)?t.connector:new y(e),void 0===this.wc)throw new Error("Failed to register WalletConnect connector");return this.wc.accounts.length&&(this.accounts=this.wc.accounts),this.wc.chainId&&(this.chainId=this.wc.chainId),this.registerConnectorEvents(),this.wc}onOpen(t){this.pending=!1,t&&(this.wc=t),this.events.emit("open")}onClose(){this.pending=!1,this.wc&&(this.wc=void 0),this.events.emit("close")}onError(t,e="Failed or Rejected Request",n=-32e3){const r={id:t.id,jsonrpc:t.jsonrpc,error:{code:n,message:e}};return this.events.emit("payload",r),r}create(t){this.wc=this.register(this.opts),this.chainId=t||this.chainId,this.connected||this.pending||(this.pending=!0,this.registerConnectorEvents(),this.wc.createSession({chainId:this.chainId}).then(()=>this.events.emit("created")).catch(t=>this.events.emit("error",t)))}registerConnectorEvents(){this.wc=this.register(this.opts),this.wc.on("connect",t=>{var e,n;t?this.events.emit("error",t):(this.accounts=(null===(e=this.wc)||void 0===e?void 0:e.accounts)||[],this.chainId=(null===(n=this.wc)||void 0===n?void 0:n.chainId)||this.chainId,this.onOpen())}),this.wc.on("disconnect",t=>{t?this.events.emit("error",t):this.onClose()}),this.wc.on("modal_closed",()=>{this.events.emit("error",new Error("User closed modal"))}),this.wc.on("session_update",(t,e)=>{const{accounts:n,chainId:r}=e.params[0];(!this.accounts||n&&this.accounts!==n)&&(this.accounts=n,this.events.emit("accountsChanged",n)),(!this.chainId||r&&this.chainId!==r)&&(this.chainId=r,this.events.emit("chainChanged",r))})}async sendPayload(t){this.wc=this.register(this.opts);try{const e=await this.wc.unsafeSend(t);return this.sanitizeResponse(e)}catch(e){return this.onError(t,e.message)}}sanitizeResponse(t){return void 0!==t.error&&void 0===t.error.code?Object(E.formatJsonRpcError)(t.id,t.error.message):t}}e.default=x},function(t,e,n){"use strict";n.r(e);var r,o,i,s,a,u,c,l={},h=[],f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function d(t,e){for(var n in e)t[n]=e[n];return t}function p(t){var e=t.parentNode;e&&e.removeChild(t)}function g(t,e,n){var r,o=arguments,i={};for(r in e)"key"!==r&&"ref"!==r&&(i[r]=e[r]);if(arguments.length>3)for(n=[n],r=3;r<arguments.length;r++)n.push(o[r]);if(null!=n&&(i.children=n),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===i[r]&&(i[r]=t.defaultProps[r]);return m(t,i,e&&e.key,e&&e.ref,null)}function m(t,e,n,o,i){var s={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i};return null==i&&(s.__v=s),r.vnode&&r.vnode(s),s}function v(){return{}}function _(t){return t.children}function y(t,e){this.props=t,this.context=e}function w(t,e){if(null==e)return t.__?w(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?w(t):null}function b(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return b(t)}}function M(t){(!t.__d&&(t.__d=!0)&&o.push(t)&&!i++||a!==r.debounceRendering)&&((a=r.debounceRendering)||s)(E)}function E(){for(var t;i=o.length;)t=o.sort((function(t,e){return t.__v.__b-e.__v.__b})),o=[],t.some((function(t){var e,n,r,o,i,s,a;t.__d&&(s=(i=(e=t).__v).__e,(a=e.__P)&&(n=[],(r=d({},i)).__v=r,o=C(a,i,r,e.__n,void 0!==a.ownerSVGElement,null,n,null==s?w(i):s),O(n,i),o!=s&&b(i)))}))}function x(t,e,n,r,o,i,s,a,u){var c,f,d,g,m,v,_,y=n&&n.__k||h,b=y.length;if(a==l&&(a=null!=i?i[0]:b?w(n,0):null),c=0,e.__k=R(e.__k,(function(n){if(null!=n){if(n.__=e,n.__b=e.__b+1,null===(d=y[c])||d&&n.key==d.key&&n.type===d.type)y[c]=void 0;else for(f=0;f<b;f++){if((d=y[f])&&n.key==d.key&&n.type===d.type){y[f]=void 0;break}d=null}if(g=C(t,n,d=d||l,r,o,i,s,a,u),(f=n.ref)&&d.ref!=f&&(_||(_=[]),d.ref&&_.push(d.ref,null,n),_.push(f,n.__c||g,n)),null!=g){var h;if(null==v&&(v=g),void 0!==n.__d)h=n.__d,n.__d=void 0;else if(i==d||g!=a||null==g.parentNode){t:if(null==a||a.parentNode!==t)t.appendChild(g),h=null;else{for(m=a,f=0;(m=m.nextSibling)&&f<b;f+=2)if(m==g)break t;t.insertBefore(g,a),h=a}"option"==e.type&&(t.value="")}a=void 0!==h?h:g.nextSibling,"function"==typeof e.type&&(e.__d=a)}else a&&d.__e==a&&a.parentNode!=t&&(a=w(d))}return c++,n})),e.__e=v,null!=i&&"function"!=typeof e.type)for(c=i.length;c--;)null!=i[c]&&p(i[c]);for(c=b;c--;)null!=y[c]&&P(y[c],y[c]);if(_)for(c=0;c<_.length;c++)I(_[c],_[++c],_[++c])}function R(t,e,n){if(null==n&&(n=[]),null==t||"boolean"==typeof t)e&&n.push(e(null));else if(Array.isArray(t))for(var r=0;r<t.length;r++)R(t[r],e,n);else n.push(e?e("string"==typeof t||"number"==typeof t?m(null,t,null,null,t):null!=t.__e||null!=t.__c?m(t.type,t.props,t.key,null,t.__v):t):t);return n}function S(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]="number"==typeof n&&!1===f.test(e)?n+"px":null==n?"":n}function k(t,e,n,r,o){var i,s,a,u,c;if(o?"className"===e&&(e="class"):"class"===e&&(e="className"),"style"===e)if(i=t.style,"string"==typeof n)i.cssText=n;else{if("string"==typeof r&&(i.cssText="",r=null),r)for(u in r)n&&u in n||S(i,u,"");if(n)for(c in n)r&&n[c]===r[c]||S(i,c,n[c])}else"o"===e[0]&&"n"===e[1]?(s=e!==(e=e.replace(/Capture$/,"")),a=e.toLowerCase(),e=(a in t?a:e).slice(2),n?(r||t.addEventListener(e,A,s),(t.l||(t.l={}))[e]=n):t.removeEventListener(e,A,s)):"list"!==e&&"tagName"!==e&&"form"!==e&&"type"!==e&&"size"!==e&&!o&&e in t?t[e]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==e&&(e!==(e=e.replace(/^xlink:?/,""))?null==n||!1===n?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(e)?t.removeAttribute(e):t.setAttribute(e,n))}function A(t){this.l[t.type](r.event?r.event(t):t)}function C(t,e,n,o,i,s,a,u,c){var l,h,f,p,g,m,v,w,b,M,E=e.type;if(void 0!==e.constructor)return null;(l=r.__b)&&l(e);try{t:if("function"==typeof E){if(w=e.props,b=(l=E.contextType)&&o[l.__c],M=l?b?b.props.value:l.__:o,n.__c?v=(h=e.__c=n.__c).__=h.__E:("prototype"in E&&E.prototype.render?e.__c=h=new E(w,M):(e.__c=h=new y(w,M),h.constructor=E,h.render=B),b&&b.sub(h),h.props=w,h.state||(h.state={}),h.context=M,h.__n=o,f=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d({},h.__s)),d(h.__s,E.getDerivedStateFromProps(w,h.__s))),p=h.props,g=h.state,f)null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==E.getDerivedStateFromProps&&w!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(w,M),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(w,h.__s,M)||e.__v===n.__v&&!h.__){for(h.props=w,h.state=h.__s,e.__v!==n.__v&&(h.__d=!1),h.__v=e,e.__e=n.__e,e.__k=n.__k,h.__h.length&&a.push(h),l=0;l<e.__k.length;l++)e.__k[l]&&(e.__k[l].__=e);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(w,h.__s,M),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,g,m)}))}h.context=M,h.props=w,h.state=h.__s,(l=r.__r)&&l(e),h.__d=!1,h.__v=e,h.__P=t,l=h.render(h.props,h.state,h.context),e.__k=null!=l&&l.type==_&&null==l.key?l.props.children:Array.isArray(l)?l:[l],null!=h.getChildContext&&(o=d(d({},o),h.getChildContext())),f||null==h.getSnapshotBeforeUpdate||(m=h.getSnapshotBeforeUpdate(p,g)),x(t,e,n,o,i,s,a,u,c),h.base=e.__e,h.__h.length&&a.push(h),v&&(h.__E=h.__=null),h.__e=!1}else null==s&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=T(n.__e,e,n,o,i,s,a,c);(l=r.diffed)&&l(e)}catch(t){e.__v=null,r.__e(t,e,n)}return e.__e}function O(t,e){r.__c&&r.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){r.__e(t,e.__v)}}))}function T(t,e,n,r,o,i,s,a){var u,c,f,d,p,g=n.props,m=e.props;if(o="svg"===e.type||o,null!=i)for(u=0;u<i.length;u++)if(null!=(c=i[u])&&((null===e.type?3===c.nodeType:c.localName===e.type)||t==c)){t=c,i[u]=null;break}if(null==t){if(null===e.type)return document.createTextNode(m);t=o?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type,m.is&&{is:m.is}),i=null,a=!1}if(null===e.type)g!==m&&t.data!=m&&(t.data=m);else{if(null!=i&&(i=h.slice.call(t.childNodes)),f=(g=n.props||l).dangerouslySetInnerHTML,d=m.dangerouslySetInnerHTML,!a){if(g===l)for(g={},p=0;p<t.attributes.length;p++)g[t.attributes[p].name]=t.attributes[p].value;(d||f)&&(d&&f&&d.__html==f.__html||(t.innerHTML=d&&d.__html||""))}(function(t,e,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in e||k(t,i,null,n[i],r);for(i in e)o&&"function"!=typeof e[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===e[i]||k(t,i,e[i],n[i],r)})(t,m,g,o,a),d?e.__k=[]:(e.__k=e.props.children,x(t,e,n,r,"foreignObject"!==e.type&&o,i,s,l,a)),a||("value"in m&&void 0!==(u=m.value)&&u!==t.value&&k(t,"value",u,g.value,!1),"checked"in m&&void 0!==(u=m.checked)&&u!==t.checked&&k(t,"checked",u,g.checked,!1))}return t}function I(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){r.__e(t,n)}}function P(t,e,n){var o,i,s;if(r.unmount&&r.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||I(o,null,e)),n||"function"==typeof t.type||(n=null!=(i=t.__e)),t.__e=t.__d=void 0,null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){r.__e(t,e)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&P(o[s],e,n);null!=i&&p(i)}function B(t,e,n){return this.constructor(t,n)}function L(t,e,n){var o,i,s;r.__&&r.__(t,e),i=(o=n===u)?null:n&&n.__k||e.__k,t=g(_,null,[t]),s=[],C(e,(o?e:n||e).__k=t,i||l,l,void 0!==e.ownerSVGElement,n&&!o?[n]:i?null:h.slice.call(e.childNodes),s,n||l,o),O(s,t)}function N(t,e){L(t,e,u)}function j(t,e){var n,r;for(r in e=d(d({},t.props),e),arguments.length>2&&(e.children=h.slice.call(arguments,2)),n={},e)"key"!==r&&"ref"!==r&&(n[r]=e[r]);return m(t.type,n,e.key||t.key,e.ref||t.ref,null)}function U(t){var e={},n={__c:"__cC"+c++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var r,o=this;return this.getChildContext||(r=[],this.getChildContext=function(){return e[n.__c]=o,e},this.shouldComponentUpdate=function(t){o.props.value!==t.value&&r.some((function(e){e.context=t.value,M(e)}))},this.sub=function(t){r.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){r.splice(r.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Consumer.contextType=n,n.Provider.__=n,n}r={__e:function(t,e){for(var n,r;e=e.__;)if((n=e.__c)&&!n.__)try{if(n.constructor&&null!=n.constructor.getDerivedStateFromError&&(r=!0,n.setState(n.constructor.getDerivedStateFromError(t))),null!=n.componentDidCatch&&(r=!0,n.componentDidCatch(t)),r)return M(n.__E=n)}catch(e){t=e}throw t}},y.prototype.setState=function(t,e){var n;n=this.__s!==this.state?this.__s:this.__s=d({},this.state),"function"==typeof t&&(t=t(n,this.props)),t&&d(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),M(this))},y.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),M(this))},y.prototype.render=_,o=[],i=0,s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=l,c=0;var q,D,J,F=0,H=[],W=r.__r,z=r.diffed,Y=r.__c,$=r.unmount;function V(t,e){r.__h&&r.__h(D,t,F||e),F=0;var n=D.__H||(D.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function K(t){return F=1,Q(lt,t)}function Q(t,e,n){var r=V(q++,2);return r.__c||(r.__c=D,r.__=[n?n(e):lt(void 0,e),function(e){var n=t(r.__[0],e);r.__[0]!==n&&(r.__[0]=n,r.__c.setState({}))}]),r.__}function Z(t,e){var n=V(q++,3);!r.__s&&ct(n.__H,e)&&(n.__=t,n.__H=e,D.__H.__h.push(n))}function X(t,e){var n=V(q++,4);!r.__s&&ct(n.__H,e)&&(n.__=t,n.__H=e,D.__h.push(n))}function G(t){return F=5,et((function(){return{current:t}}),[])}function tt(t,e,n){F=6,X((function(){"function"==typeof t?t(e()):t&&(t.current=e())}),null==n?n:n.concat(t))}function et(t,e){var n=V(q++,7);return ct(n.__H,e)?(n.__H=e,n.__h=t,n.__=t()):n.__}function nt(t,e){return F=8,et((function(){return t}),e)}function rt(t){var e=D.context[t.__c],n=V(q++,9);return n.__c=t,e?(null==n.__&&(n.__=!0,e.sub(D)),e.props.value):t.__}function ot(t,e){r.useDebugValue&&r.useDebugValue(e?e(t):t)}function it(t){var e=V(q++,10),n=K();return e.__=t,D.componentDidCatch||(D.componentDidCatch=function(t){e.__&&e.__(t),n[1](t)}),[n[0],function(){n[1](void 0)}]}function st(){H.some((function(t){if(t.__P)try{t.__H.__h.forEach(at),t.__H.__h.forEach(ut),t.__H.__h=[]}catch(e){return t.__H.__h=[],r.__e(e,t.__v),!0}})),H=[]}function at(t){t.t&&t.t()}function ut(t){var e=t.__();"function"==typeof e&&(t.t=e)}function ct(t,e){return!t||e.some((function(e,n){return e!==t[n]}))}function lt(t,e){return"function"==typeof e?e(t):e}function ht(t,e){for(var n in e)t[n]=e[n];return t}function ft(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var r in e)if("__source"!==r&&t[r]!==e[r])return!0;return!1}r.__r=function(t){W&&W(t),q=0,(D=t.__c).__H&&(D.__H.__h.forEach(at),D.__H.__h.forEach(ut),D.__H.__h=[])},r.diffed=function(t){z&&z(t);var e=t.__c;if(e){var n=e.__H;n&&n.__h.length&&(1!==H.push(e)&&J===r.requestAnimationFrame||((J=r.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(r),cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);"undefined"!=typeof window&&(e=requestAnimationFrame(n))})(st))}},r.__c=function(t,e){e.some((function(t){try{t.__h.forEach(at),t.__h=t.__h.filter((function(t){return!t.__||ut(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],r.__e(n,t.__v)}})),Y&&Y(t,e)},r.unmount=function(t){$&&$(t);var e=t.__c;if(e){var n=e.__H;if(n)try{n.__.forEach((function(t){return t.t&&t.t()}))}catch(t){r.__e(t,e.__v)}}},n.d(e,"version",(function(){return jt})),n.d(e,"Children",(function(){return _t})),n.d(e,"render",(function(){return Tt})),n.d(e,"hydrate",(function(){return It})),n.d(e,"unmountComponentAtNode",(function(){return Jt})),n.d(e,"createPortal",(function(){return At})),n.d(e,"createFactory",(function(){return Ut})),n.d(e,"cloneElement",(function(){return Dt})),n.d(e,"isValidElement",(function(){return qt})),n.d(e,"findDOMNode",(function(){return Ft})),n.d(e,"PureComponent",(function(){return dt})),n.d(e,"memo",(function(){return pt})),n.d(e,"forwardRef",(function(){return mt})),n.d(e,"unstable_batchedUpdates",(function(){return Ht})),n.d(e,"Suspense",(function(){return bt})),n.d(e,"SuspenseList",(function(){return xt})),n.d(e,"lazy",(function(){return Et})),n.d(e,"useState",(function(){return K})),n.d(e,"useReducer",(function(){return Q})),n.d(e,"useEffect",(function(){return Z})),n.d(e,"useLayoutEffect",(function(){return X})),n.d(e,"useRef",(function(){return G})),n.d(e,"useImperativeHandle",(function(){return tt})),n.d(e,"useMemo",(function(){return et})),n.d(e,"useCallback",(function(){return nt})),n.d(e,"useContext",(function(){return rt})),n.d(e,"useDebugValue",(function(){return ot})),n.d(e,"useErrorBoundary",(function(){return it})),n.d(e,"createElement",(function(){return g})),n.d(e,"createContext",(function(){return U})),n.d(e,"createRef",(function(){return v})),n.d(e,"Fragment",(function(){return _})),n.d(e,"Component",(function(){return y}));var dt=function(t){var e,n;function r(e){var n;return(n=t.call(this,e)||this).isPureReactComponent=!0,n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r.prototype.shouldComponentUpdate=function(t,e){return ft(this.props,t)||ft(this.state,e)},r}(y);function pt(t,e){function n(t){var n=this.props.ref,r=n==t.ref;return!r&&n&&(n.call?n(null):n.current=null),e?!e(this.props,t)||!r:ft(this.props,t)}function r(e){return this.shouldComponentUpdate=n,g(t,ht({},e))}return r.prototype.isReactComponent=!0,r.displayName="Memo("+(t.displayName||t.name)+")",r.t=!0,r}var gt=r.__b;function mt(t){function e(e){var n=ht({},e);return delete n.ref,t(n,e.ref)}return e.prototype.isReactComponent=e.t=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}r.__b=function(t){t.type&&t.type.t&&t.ref&&(t.props.ref=t.ref,t.ref=null),gt&>(t)};var vt=function(t,e){return t?R(t).reduce((function(t,n,r){return t.concat(e(n,r))}),[]):null},_t={map:vt,forEach:vt,count:function(t){return t?R(t).length:0},only:function(t){if(1!==(t=R(t)).length)throw new Error("Children.only() expects only one child.");return t[0]},toArray:R},yt=r.__e;function wt(t){return t&&((t=ht({},t)).__c=null,t.__k=t.__k&&t.__k.map(wt)),t}function bt(){this.__u=0,this.o=null,this.__b=null}function Mt(t){var e=t.__.__c;return e&&e.u&&e.u(t)}function Et(t){var e,n,r;function o(o){if(e||(e=t()).then((function(t){n=t.default||t}),(function(t){r=t})),r)throw r;if(!n)throw e;return g(n,o)}return o.displayName="Lazy",o.t=!0,o}function xt(){this.i=null,this.l=null}r.__e=function(t,e,n){if(t.then)for(var r,o=e;o=o.__;)if((r=o.__c)&&r.__c)return r.__c(t,e.__c);yt(t,e,n)},(bt.prototype=new y).__c=function(t,e){var n=this;null==n.o&&(n.o=[]),n.o.push(e);var r=Mt(n.__v),o=!1,i=function(){o||(o=!0,r?r(s):s())};e.__c=e.componentWillUnmount,e.componentWillUnmount=function(){i(),e.__c&&e.__c()};var s=function(){var t;if(!--n.__u)for(n.__v.__k[0]=n.state.u,n.setState({u:n.__b=null});t=n.o.pop();)t.forceUpdate()};n.__u++||n.setState({u:n.__b=n.__v.__k[0]}),t.then(i,i)},bt.prototype.render=function(t,e){return this.__b&&(this.__v.__k[0]=wt(this.__b),this.__b=null),[g(y,null,e.u?null:t.children),e.u&&t.fallback]};var Rt=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};(xt.prototype=new y).u=function(t){var e=this,n=Mt(e.__v),r=e.l.get(t);return r[0]++,function(o){var i=function(){e.props.revealOrder?(r.push(o),Rt(e,t,r)):o()};n?n(i):i()}},xt.prototype.render=function(t){this.i=null,this.l=new Map;var e=R(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},xt.prototype.componentDidUpdate=xt.prototype.componentDidMount=function(){var t=this;t.l.forEach((function(e,n){Rt(t,n,e)}))};var St=function(){function t(){}var e=t.prototype;return e.getChildContext=function(){return this.props.context},e.render=function(t){return t.children},t}();function kt(t){var e=this,n=t.container,r=g(St,{context:e.context},t.vnode);return e.s&&e.s!==n&&(e.v.parentNode&&e.s.removeChild(e.v),P(e.h),e.p=!1),t.vnode?e.p?(n.__k=e.__k,L(r,n),e.__k=n.__k):(e.v=document.createTextNode(""),N("",n),n.appendChild(e.v),e.p=!0,e.s=n,L(r,n,e.v),e.__k=e.v.__k):e.p&&(e.v.parentNode&&e.s.removeChild(e.v),P(e.h)),e.h=r,e.componentWillUnmount=function(){e.v.parentNode&&e.s.removeChild(e.v),P(e.h)},null}function At(t,e){return g(kt,{vnode:t,container:e})}var Ct=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;y.prototype.isReactComponent={};var Ot="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function Tt(t,e,n){if(null==e.__k)for(;e.firstChild;)e.removeChild(e.firstChild);return L(t,e),"function"==typeof n&&n(),t?t.__c:null}function It(t,e,n){return N(t,e),"function"==typeof n&&n(),t?t.__c:null}var Pt=r.event;function Bt(t,e){t["UNSAFE_"+e]&&!t[e]&&Object.defineProperty(t,e,{configurable:!1,get:function(){return this["UNSAFE_"+e]},set:function(t){this["UNSAFE_"+e]=t}})}r.event=function(t){Pt&&(t=Pt(t)),t.persist=function(){};var e=!1,n=!1,r=t.stopPropagation;t.stopPropagation=function(){r.call(t),e=!0};var o=t.preventDefault;return t.preventDefault=function(){o.call(t),n=!0},t.isPropagationStopped=function(){return e},t.isDefaultPrevented=function(){return n},t.nativeEvent=t};var Lt={configurable:!0,get:function(){return this.class}},Nt=r.vnode;r.vnode=function(t){t.$$typeof=Ot;var e=t.type,n=t.props;if(e){if(n.class!=n.className&&(Lt.enumerable="className"in n,null!=n.className&&(n.class=n.className),Object.defineProperty(n,"className",Lt)),"function"!=typeof e){var r,o,i;for(i in n.defaultValue&&void 0!==n.value&&(n.value||0===n.value||(n.value=n.defaultValue),delete n.defaultValue),Array.isArray(n.value)&&n.multiple&&"select"===e&&(R(n.children).forEach((function(t){-1!=n.value.indexOf(t.props.value)&&(t.props.selected=!0)})),delete n.value),n)if(r=Ct.test(i))break;if(r)for(i in o=t.props={},n)o[Ct.test(i)?i.replace(/[A-Z0-9]/,"-$&").toLowerCase():i]=n[i]}!function(e){var n=t.type,r=t.props;if(r&&"string"==typeof n){var o={};for(var i in r)/^on(Ani|Tra|Tou)/.test(i)&&(r[i.toLowerCase()]=r[i],delete r[i]),o[i.toLowerCase()]=i;if(o.ondoubleclick&&(r.ondblclick=r[o.ondoubleclick],delete r[o.ondoubleclick]),o.onbeforeinput&&(r.onbeforeinput=r[o.onbeforeinput],delete r[o.onbeforeinput]),o.onchange&&("textarea"===n||"input"===n.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var s=o.oninput||"oninput";r[s]||(r[s]=r[o.onchange],delete r[o.onchange])}}}(),"function"==typeof e&&!e.m&&e.prototype&&(Bt(e.prototype,"componentWillMount"),Bt(e.prototype,"componentWillReceiveProps"),Bt(e.prototype,"componentWillUpdate"),e.m=!0)}Nt&&Nt(t)};var jt="16.8.0";function Ut(t){return g.bind(null,t)}function qt(t){return!!t&&t.$$typeof===Ot}function Dt(t){return qt(t)?j.apply(null,arguments):t}function Jt(t){return!!t.__k&&(L(null,t),!0)}function Ft(t){return t&&(t.base||1===t.nodeType&&t)||null}var Ht=function(t,e){return t(e)};e.default={useState:K,useReducer:Q,useEffect:Z,useLayoutEffect:X,useRef:G,useImperativeHandle:tt,useMemo:et,useCallback:nt,useContext:rt,useDebugValue:ot,version:"16.8.0",Children:_t,render:Tt,hydrate:Tt,unmountComponentAtNode:Jt,createPortal:At,createElement:g,createContext:U,createFactory:Ut,cloneElement:Dt,createRef:v,Fragment:_,isValidElement:qt,findDOMNode:Ft,Component:y,PureComponent:dt,memo:pt,forwardRef:mt,unstable_batchedUpdates:Ht,Suspense:bt,SuspenseList:xt,lazy:Et}},function(t,e,n){"use strict";n.r(e);var r=n(20),o=n(5);class i extends o.IJsonRpcProvider{constructor(t){super(t),this.events=new r.EventEmitter,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async request(t,e){return this.requestStrict(Object(o.formatJsonRpcRequest)(t.method,t.params||[]),e)}async requestStrict(t,e){return new Promise(async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(t){r(t)}this.events.on(""+t.id,t=>{Object(o.isJsonRpcError)(t)?r(t.error.message):n(t.result)});try{await this.connection.send(t,e)}catch(t){r(t)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Object(o.isJsonRpcResponse)(t)?this.events.emit(""+t.id,t):this.events.emit("message",{type:t.method,data:t.params})}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof t&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close(),this.events.emit("disconnect")}registerEventListeners(){this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",()=>this.events.emit("disconnect")),this.connection.on("error",t=>this.events.emit("error",t))}}var s=i;n.d(e,"JsonRpcProvider",(function(){return i}));e.default=s},function(t,e,n){"use strict";n.r(e);var r=n(20),o=n(27),i=n.n(o),s=n(11),a=n(5);const u={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class c{constructor(t){if(this.url=t,this.events=new r.EventEmitter,this.isAvailable=!1,this.registering=!1,!Object(a.isHttpUrl)(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);this.url=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t,e){this.isAvailable||await this.register();try{const e=Object(s.b)(t),n=await i()(this.url,Object.assign(Object.assign({},u),{body:e})),r=await n.json();this.onPayload({data:r})}catch(e){this.onError(t.id,e)}}async register(t=this.url){if(!Object(a.isHttpUrl)(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);if(this.registering)return new Promise((t,e)=>{this.events.once("register_error",t=>{e(t)}),this.events.once("open",()=>{if(void 0===this.isAvailable)return e(new Error("HTTP connection is missing or invalid"));t()})});this.url=t,this.registering=!0;try{const e=Object(s.b)({id:1,jsonrpc:"2.0",method:"test",params:[]});await i()(t,Object.assign(Object.assign({},u),{body:e})),this.onOpen()}catch(t){const e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(void 0===t.data)return;const e="string"==typeof t.data?Object(s.a)(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const n=this.parseError(e),r=n.message||n.toString(),o=Object(a.formatJsonRpcError)(t,r);this.events.emit("payload",o)}parseError(t,e=this.url){return Object(a.parseConnectionError)(t,e,"HTTP")}}var l=c;n.d(e,"HttpConnection",(function(){return c}));e.default=l}])}));
|
|
33
|
+
e.read=function(t,e,n,r,o){var i,s,a=8*o-r-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?o-1:0,f=n?-1:1,d=t[e+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+t[e+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=c}return(d?-1:1)*s*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var s,a,u,c=8*i-o-1,l=(1<<c)-1,h=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[n+d]=255&s,d+=p,s/=256,c-=8);t[n+d-p]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function s(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=s(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),a=0;a<i.length;a++){var u=i[a];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}},function(t,e,n){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(t,e,n){var r=n(72),o=n(73),i=n(90),s=n(91);function a(t,e,n,i,s){var a=[].slice.call(arguments,1),u=a.length,c="function"==typeof a[u-1];if(!c&&!r())throw new Error("Callback required as last argument");if(!c){if(u<1)throw new Error("Too few arguments provided");return 1===u?(n=e,e=i=void 0):2!==u||e.getContext||(i=n,n=e,e=void 0),new Promise((function(r,s){try{var a=o.create(n,i);r(t(a,e,i))}catch(t){s(t)}}))}if(u<2)throw new Error("Too few arguments provided");2===u?(s=n,n=e,e=i=void 0):3===u&&(e.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=e,e=void 0));try{var l=o.create(n,i);s(null,t(l,e,i))}catch(t){s(t)}}e.create=o.create,e.toCanvas=a.bind(null,i.render),e.toDataURL=a.bind(null,i.renderToDataURL),e.toString=a.bind(null,(function(t,e,n){return s.render(t,n)}))},function(t,e){t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},function(t,e,n){var r=n(12),o=n(8),i=n(23),s=n(74),a=n(75),u=n(76),c=n(77),l=n(78),h=n(46),f=n(79),d=n(82),p=n(83),g=n(9),m=n(84),v=n(22);function _(t,e,n){var r,o,i=t.size,s=p.getEncodedBits(e,n);for(r=0;r<15;r++)o=1==(s>>r&1),r<6?t.set(r,8,o,!0):r<8?t.set(r+1,8,o,!0):t.set(i-15+r,8,o,!0),r<8?t.set(8,i-r-1,o,!0):r<9?t.set(8,15-r-1+1,o,!0):t.set(8,15-r-1,o,!0);t.set(i-8,8,1,!0)}function y(t,e,n){var i=new s;n.forEach((function(e){i.put(e.mode.bit,4),i.put(e.getLength(),g.getCharCountIndicator(e.mode,t)),e.write(i)}));var a=8*(o.getSymbolTotalCodewords(t)-h.getTotalCodewordsCount(t,e));for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);for(var u=(a-i.getLengthInBits())/8,c=0;c<u;c++)i.put(c%2?17:236,8);return function(t,e,n){for(var i=o.getSymbolTotalCodewords(e),s=h.getTotalCodewordsCount(e,n),a=i-s,u=h.getBlocksCount(e,n),c=u-i%u,l=Math.floor(i/u),d=Math.floor(a/u),p=d+1,g=l-d,m=new f(g),v=0,_=new Array(u),y=new Array(u),w=0,b=r.from(t.buffer),M=0;M<u;M++){var E=M<c?d:p;_[M]=b.slice(v,v+E),y[M]=m.encode(_[M]),v+=E,w=Math.max(w,E)}var x,R,S=r.alloc(i),k=0;for(x=0;x<w;x++)for(R=0;R<u;R++)x<_[R].length&&(S[k++]=_[R][x]);for(x=0;x<g;x++)for(R=0;R<u;R++)S[k++]=y[R][x];return S}(i,t,e)}function w(t,e,n,r){var i;if(v(t))i=m.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");var s=e;if(!s){var h=m.rawSplit(t);s=d.getBestVersionForData(h,n)}i=m.fromString(t,s||40)}var f=d.getBestVersionForData(i,n);if(!f)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<f)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+f+".\n")}else e=f;var p=y(e,n,i),g=o.getSymbolSize(e),w=new a(g);return function(t,e){for(var n=t.size,r=c.getPositions(e),o=0;o<r.length;o++)for(var i=r[o][0],s=r[o][1],a=-1;a<=7;a++)if(!(i+a<=-1||n<=i+a))for(var u=-1;u<=7;u++)s+u<=-1||n<=s+u||(a>=0&&a<=6&&(0===u||6===u)||u>=0&&u<=6&&(0===a||6===a)||a>=2&&a<=4&&u>=2&&u<=4?t.set(i+a,s+u,!0,!0):t.set(i+a,s+u,!1,!0))}(w,e),function(t){for(var e=t.size,n=8;n<e-8;n++){var r=n%2==0;t.set(n,6,r,!0),t.set(6,n,r,!0)}}(w),function(t,e){for(var n=u.getPositions(e),r=0;r<n.length;r++)for(var o=n[r][0],i=n[r][1],s=-2;s<=2;s++)for(var a=-2;a<=2;a++)-2===s||2===s||-2===a||2===a||0===s&&0===a?t.set(o+s,i+a,!0,!0):t.set(o+s,i+a,!1,!0)}(w,e),_(w,n,0),e>=7&&function(t,e){for(var n,r,o,i=t.size,s=d.getEncodedBits(e),a=0;a<18;a++)n=Math.floor(a/3),r=a%3+i-8-3,o=1==(s>>a&1),t.set(n,r,o,!0),t.set(r,n,o,!0)}(w,e),function(t,e){for(var n=t.size,r=-1,o=n-1,i=7,s=0,a=n-1;a>0;a-=2)for(6===a&&a--;;){for(var u=0;u<2;u++)if(!t.isReserved(o,a-u)){var c=!1;s<e.length&&(c=1==(e[s]>>>i&1)),t.set(o,a-u,c),-1===--i&&(s++,i=7)}if((o+=r)<0||n<=o){o-=r,r=-r;break}}}(w,p),isNaN(r)&&(r=l.getBestMask(w,_.bind(null,w,n))),l.applyMask(r,w),_(w,n,r),{modules:w,version:e,errorCorrectionLevel:n,maskPattern:r,segments:i}}e.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");var n,r,s=i.M;return void 0!==e&&(s=i.from(e.errorCorrectionLevel,i.M),n=d.from(e.version),r=l.from(e.maskPattern),e.toSJISFunc&&o.setToSJISFunction(e.toSJISFunc)),w(t,n,s,r)}},function(t,e){function n(){this.buffer=[],this.length=0}n.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=n},function(t,e,n){var r=n(12);function o(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=r.alloc(t*t),this.reservedBit=r.alloc(t*t)}o.prototype.set=function(t,e,n,r){var o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)},o.prototype.get=function(t,e){return this.data[t*this.size+e]},o.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},o.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},t.exports=o},function(t,e,n){var r=n(8).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];for(var e=Math.floor(t/7)+2,n=r(t),o=145===n?26:2*Math.ceil((n-13)/(2*e-2)),i=[n-7],s=1;s<e-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){for(var n=[],r=e.getRowColCoords(t),o=r.length,i=0;i<o;i++)for(var s=0;s<o;s++)0===i&&0===s||0===i&&s===o-1||i===o-1&&0===s||n.push([r[i],r[s]]);return n}},function(t,e,n){var r=n(8).getSymbolSize;e.getPositions=function(t){var e=r(t);return[[0,0],[e-7,0],[0,e-7]]}},function(t,e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var n=3,r=3,o=40,i=10;function s(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){for(var e=t.size,r=0,o=0,i=0,s=null,a=null,u=0;u<e;u++){o=i=0,s=a=null;for(var c=0;c<e;c++){var l=t.get(u,c);l===s?o++:(o>=5&&(r+=n+(o-5)),s=l,o=1),(l=t.get(c,u))===a?i++:(i>=5&&(r+=n+(i-5)),a=l,i=1)}o>=5&&(r+=n+(o-5)),i>=5&&(r+=n+(i-5))}return r},e.getPenaltyN2=function(t){for(var e=t.size,n=0,o=0;o<e-1;o++)for(var i=0;i<e-1;i++){var s=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);4!==s&&0!==s||n++}return n*r},e.getPenaltyN3=function(t){for(var e=t.size,n=0,r=0,i=0,s=0;s<e;s++){r=i=0;for(var a=0;a<e;a++)r=r<<1&2047|t.get(s,a),a>=10&&(1488===r||93===r)&&n++,i=i<<1&2047|t.get(a,s),a>=10&&(1488===i||93===i)&&n++}return n*o},e.getPenaltyN4=function(t){for(var e=0,n=t.data.length,r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*i},e.applyMask=function(t,e){for(var n=e.size,r=0;r<n;r++)for(var o=0;o<n;o++)e.isReserved(o,r)||e.xor(o,r,s(t,o,r))},e.getBestMask=function(t,n){for(var r=Object.keys(e.Patterns).length,o=0,i=1/0,s=0;s<r;s++){n(s),e.applyMask(s,t);var a=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),a<i&&(i=a,o=s)}return o}},function(t,e,n){var r=n(12),o=n(80),i=n(21).Buffer;function s(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}s.prototype.initialize=function(t){this.degree=t,this.genPoly=o.generateECPolynomial(this.degree)},s.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");var e=r.alloc(this.degree),n=i.concat([t,e],t.length+this.degree),s=o.mod(n,this.genPoly),a=this.degree-s.length;if(a>0){var u=r.alloc(this.degree);return s.copy(u,a),u}return s},t.exports=s},function(t,e,n){var r=n(12),o=n(81);e.mul=function(t,e){for(var n=r.alloc(t.length+e.length-1),i=0;i<t.length;i++)for(var s=0;s<e.length;s++)n[i+s]^=o.mul(t[i],e[s]);return n},e.mod=function(t,e){for(var n=r.from(t);n.length-e.length>=0;){for(var i=n[0],s=0;s<e.length;s++)n[s]^=o.mul(e[s],i);for(var a=0;a<n.length&&0===n[a];)a++;n=n.slice(a)}return n},e.generateECPolynomial=function(t){for(var n=r.from([1]),i=0;i<t;i++)n=e.mul(n,[1,o.exp(i)]);return n}},function(t,e,n){var r=n(12),o=r.alloc(512),i=r.alloc(256);!function(){for(var t=1,e=0;e<255;e++)o[e]=t,i[t]=e,256&(t<<=1)&&(t^=285);for(e=255;e<512;e++)o[e]=o[e-255]}(),e.log=function(t){if(t<1)throw new Error("log("+t+")");return i[t]},e.exp=function(t){return o[t]},e.mul=function(t,e){return 0===t||0===e?0:o[i[t]+i[e]]}},function(t,e,n){var r=n(8),o=n(46),i=n(23),s=n(9),a=n(47),u=n(22),c=r.getBCHDigit(7973);function l(t,e){return s.getCharCountIndicator(t,e)+4}function h(t,e){var n=0;return t.forEach((function(t){var r=l(t.mode,e);n+=r+t.getBitsLength()})),n}e.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},e.getCapacity=function(t,e,n){if(!a.isValid(t))throw new Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);var i=8*(r.getSymbolTotalCodewords(t)-o.getTotalCodewordsCount(t,e));if(n===s.MIXED)return i;var u=i-l(n,t);switch(n){case s.NUMERIC:return Math.floor(u/10*3);case s.ALPHANUMERIC:return Math.floor(u/11*2);case s.KANJI:return Math.floor(u/13);case s.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,n){var r,o=i.from(n,i.M);if(u(t)){if(t.length>1)return function(t,n){for(var r=1;r<=40;r++){if(h(t,r)<=e.getCapacity(r,n,s.MIXED))return r}}(t,o);if(0===t.length)return 1;r=t[0]}else r=t;return function(t,n,r){for(var o=1;o<=40;o++)if(n<=e.getCapacity(o,r,t))return o}(r.mode,r.getLength(),o)},e.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");for(var e=t<<12;r.getBCHDigit(e)-c>=0;)e^=7973<<r.getBCHDigit(e)-c;return t<<12|e}},function(t,e,n){var r=n(8),o=r.getBCHDigit(1335);e.getEncodedBits=function(t,e){for(var n=t.bit<<3|e,i=n<<10;r.getBCHDigit(i)-o>=0;)i^=1335<<r.getBCHDigit(i)-o;return 21522^(n<<10|i)}},function(t,e,n){var r=n(9),o=n(85),i=n(86),s=n(87),a=n(88),u=n(48),c=n(8),l=n(89);function h(t){return unescape(encodeURIComponent(t)).length}function f(t,e,n){for(var r,o=[];null!==(r=t.exec(n));)o.push({data:r[0],index:r.index,mode:e,length:r[0].length});return o}function d(t){var e,n,o=f(u.NUMERIC,r.NUMERIC,t),i=f(u.ALPHANUMERIC,r.ALPHANUMERIC,t);return c.isKanjiModeEnabled()?(e=f(u.BYTE,r.BYTE,t),n=f(u.KANJI,r.KANJI,t)):(e=f(u.BYTE_KANJI,r.BYTE,t),n=[]),o.concat(i,e,n).sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function p(t,e){switch(e){case r.NUMERIC:return o.getBitsLength(t);case r.ALPHANUMERIC:return i.getBitsLength(t);case r.KANJI:return a.getBitsLength(t);case r.BYTE:return s.getBitsLength(t)}}function g(t,e){var n,u=r.getBestModeForData(t);if((n=r.from(e,u))!==r.BYTE&&n.bit<u.bit)throw new Error('"'+t+'" cannot be encoded with mode '+r.toString(n)+".\n Suggested mode is: "+r.toString(u));switch(n!==r.KANJI||c.isKanjiModeEnabled()||(n=r.BYTE),n){case r.NUMERIC:return new o(t);case r.ALPHANUMERIC:return new i(t);case r.KANJI:return new a(t);case r.BYTE:return new s(t)}}e.fromArray=function(t){return t.reduce((function(t,e){return"string"==typeof e?t.push(g(e,null)):e.data&&t.push(g(e.data,e.mode)),t}),[])},e.fromString=function(t,n){for(var o=function(t,e){for(var n={},o={start:{}},i=["start"],s=0;s<t.length;s++){for(var a=t[s],u=[],c=0;c<a.length;c++){var l=a[c],h=""+s+c;u.push(h),n[h]={node:l,lastCount:0},o[h]={};for(var f=0;f<i.length;f++){var d=i[f];n[d]&&n[d].node.mode===l.mode?(o[d][h]=p(n[d].lastCount+l.length,l.mode)-p(n[d].lastCount,l.mode),n[d].lastCount+=l.length):(n[d]&&(n[d].lastCount=l.length),o[d][h]=p(l.length,l.mode)+4+r.getCharCountIndicator(l.mode,e))}}i=u}for(f=0;f<i.length;f++)o[i[f]].end=0;return{map:o,table:n}}(function(t){for(var e=[],n=0;n<t.length;n++){var o=t[n];switch(o.mode){case r.NUMERIC:e.push([o,{data:o.data,mode:r.ALPHANUMERIC,length:o.length},{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.ALPHANUMERIC:e.push([o,{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.KANJI:e.push([o,{data:o.data,mode:r.BYTE,length:h(o.data)}]);break;case r.BYTE:e.push([{data:o.data,mode:r.BYTE,length:h(o.data)}])}}return e}(d(t,c.isKanjiModeEnabled())),n),i=l.find_path(o.map,"start","end"),s=[],a=1;a<i.length-1;a++)s.push(o.table[i[a]].node);return e.fromArray(function(t){return t.reduce((function(t,e){var n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(s))},e.rawSplit=function(t){return e.fromArray(d(t,c.isKanjiModeEnabled()))}},function(t,e,n){var r=n(9);function o(t){this.mode=r.NUMERIC,this.data=t.toString()}o.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){var e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);var o=this.data.length-e;o>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*o+1))},t.exports=o},function(t,e,n){var r=n(9),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(t){this.mode=r.ALPHANUMERIC,this.data=t}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){var e;for(e=0;e+2<=this.data.length;e+=2){var n=45*o.indexOf(this.data[e]);n+=o.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(o.indexOf(this.data[e]),6)},t.exports=i},function(t,e,n){var r=n(12),o=n(9);function i(t){this.mode=o.BYTE,this.data=r.from(t)}i.getBitsLength=function(t){return 8*t},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){for(var e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)},t.exports=i},function(t,e,n){var r=n(9),o=n(8);function i(t){this.mode=r.KANJI,this.data=t}i.getBitsLength=function(t){return 13*t},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var n=o.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}},t.exports=i},function(t,e,n){"use strict";var r={single_source_shortest_paths:function(t,e,n){var o={},i={};i[e]=0;var s,a,u,c,l,h,f,d=r.PriorityQueue.make();for(d.push(e,0);!d.empty();)for(u in a=(s=d.pop()).value,c=s.cost,l=t[a]||{})l.hasOwnProperty(u)&&(h=c+l[u],f=i[u],(void 0===i[u]||f>h)&&(i[u]=h,d.push(u,h),o[u]=a));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,e,n){var o=r.single_source_shortest_paths(t,e,n);return r.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e,n=r.PriorityQueue,o={};for(e in t=t||{},n)n.hasOwnProperty(e)&&(o[e]=n[e]);return o.queue=[],o.sorter=t.sorter||n.default_sorter,o},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=r},function(t,e,n){var r=n(49);e.render=function(t,e,n){var o=n,i=e;void 0!==o||e&&e.getContext||(o=e,e=void 0),e||(i=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),o=r.getOptions(o);var s=r.getImageWidth(t.modules.size,o),a=i.getContext("2d"),u=a.createImageData(s,s);return r.qrToImageData(u.data,t,o),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(a,i,s),a.putImageData(u,0,0),i},e.renderToDataURL=function(t,n,r){var o=r;void 0!==o||n&&n.getContext||(o=n,n=void 0),o||(o={});var i=e.render(t,n,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}},function(t,e,n){var r=n(49);function o(t,e){var n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function i(t,e,n){var r=t+e;return void 0!==n&&(r+=" "+n),r}e.render=function(t,e,n){var s=r.getOptions(e),a=t.modules.size,u=t.modules.data,c=a+2*s.margin,l=s.color.light.a?"<path "+o(s.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",h="<path "+o(s.color.dark,"stroke")+' d="'+function(t,e,n){for(var r="",o=0,s=!1,a=0,u=0;u<t.length;u++){var c=Math.floor(u%e),l=Math.floor(u/e);c||s||(s=!0),t[u]?(a++,u>0&&c>0&&t[u-1]||(r+=s?i("M",c+n,.5+l+n):i("m",o,0),o=0,s=!1),c+1<e&&t[u+1]||(r+=i("h",a),a=0)):o++}return r}(u,a,s.margin)+'"/>',f='viewBox="0 0 '+c+" "+c+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+f+' shape-rendering="crispEdges">'+l+h+"</svg>\n";return"function"==typeof n&&n(null,d),d}},function(t,e,n){"use strict";var r=n(93),o={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var n,i,s,a,u,c,l=!1;e||(e={}),n=e.debug||!1;try{if(s=r(),a=document.createRange(),u=document.getSelection(),(c=document.createElement("span")).textContent=t,c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(r){if(r.stopPropagation(),e.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=o[e.format]||o.default;window.clipboardData.setData(i,t)}else r.clipboardData.clearData(),r.clipboardData.setData(e.format,t);e.onCopy&&(r.preventDefault(),e.onCopy(r.clipboardData))})),document.body.appendChild(c),a.selectNodeContents(c),u.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),l=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),i=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,t)}}finally{u&&("function"==typeof u.removeRange?u.removeRange(a):u.removeAllRanges()),c&&document.body.removeChild(c),s()}return l}},function(t,e){t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],r=0;r<t.rangeCount;r++)n.push(t.getRangeAt(r));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null}return t.removeAllRanges(),function(){"Caret"===t.type&&t.removeAllRanges(),t.rangeCount||n.forEach((function(e){t.addRange(e)})),e&&e.focus()}}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"generateKey",(function(){return g})),n.d(r,"verifyHmac",(function(){return m})),n.d(r,"encrypt",(function(){return v})),n.d(r,"decrypt",(function(){return _}));var o=n(25),i=n.n(o),s=n(1),a=n(54);var u=class{constructor(){this._eventEmitters=[]}subscribe(t){this._eventEmitters.push(t)}unsubscribe(t){this._eventEmitters=this._eventEmitters.filter(e=>e.event!==t)}trigger(t){let e,n=[];e=Object(s.isJsonRpcRequest)(t)?t.method:Object(s.isJsonRpcResponseSuccess)(t)||Object(s.isJsonRpcResponseError)(t)?"response:"+t.id:Object(s.isInternalEvent)(t)?t.event:"",e&&(n=this._eventEmitters.filter(t=>t.event===e)),n&&n.length||Object(s.isReservedEvent)(e)||Object(s.isInternalEvent)(e)||(n=this._eventEmitters.filter(t=>"call_request"===t.event)),n.forEach(e=>{if(Object(s.isJsonRpcResponseError)(t)){const n=new Error(t.error.message);e.callback(n,null)}else e.callback(null,t)})}};var c=class{constructor(t="walletconnect"){this.storageId=t}getSession(){let t=null;const e=Object(s.getLocal)(this.storageId);return e&&Object(s.isWalletConnectSession)(e)&&(t=e),t}setSession(t){return Object(s.setLocal)(this.storageId,t),t}removeSession(){Object(s.removeLocal)(this.storageId)}};const l="abcdefghijklmnopqrstuvwxyz0123456789".split("").map(t=>`https://${t}.bridge.walletconnect.org`);function h(){return l[Math.floor(Math.random()*l.length)]}var f=class{constructor(t){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new u,this._clientMeta=Object(s.getClientMeta)()||t.connectorOpts.clientMeta||null,this._cryptoLib=t.cryptoLib,this._sessionStorage=t.sessionStorage||new c(t.connectorOpts.storageId),this._qrcodeModal=t.connectorOpts.qrcodeModal,this._qrcodeModalOptions=t.connectorOpts.qrcodeModalOptions,this._signingMethods=[...s.signingMethods,...t.connectorOpts.signingMethods||[]],!t.connectorOpts.bridge&&!t.connectorOpts.uri&&!t.connectorOpts.session)throw new Error("Missing one of the required parameters: bridge / uri / session");var e;t.connectorOpts.bridge&&(this.bridge=function(t){return"walletconnect.org"===function(t){return function(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}(t).split(".").slice(-2).join(".")}(t)}(e=t.connectorOpts.bridge)?h():e),t.connectorOpts.uri&&(this.uri=t.connectorOpts.uri);const n=t.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=t.transport||new a.a({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),t.connectorOpts.uri&&this._subscribeToSessionRequest(),t.pushServerOpts&&this._registerPushServer(t.pushServerOpts)}set bridge(t){t&&(this._bridge=t)}get bridge(){return this._bridge}set key(t){if(!t)return;const e=Object(s.convertHexToArrayBuffer)(t);this._key=e}get key(){if(this._key){return Object(s.convertArrayBufferToHex)(this._key,!0)}return""}set clientId(t){t&&(this._clientId=t)}get clientId(){let t=this._clientId;return t||(t=this._clientId=Object(s.uuid)()),this._clientId}set peerId(t){t&&(this._peerId=t)}get peerId(){return this._peerId}set clientMeta(t){}get clientMeta(){let t=this._clientMeta;return t||(t=this._clientMeta=Object(s.getClientMeta)()),t}set peerMeta(t){this._peerMeta=t}get peerMeta(){return this._peerMeta}set handshakeTopic(t){t&&(this._handshakeTopic=t)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(t){t&&(this._handshakeId=t)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(t){if(!t)return;const{handshakeTopic:e,bridge:n,key:r}=this._parseUri(t);this.handshakeTopic=e,this.bridge=n,this.key=r}set chainId(t){this._chainId=t}get chainId(){return this._chainId}set networkId(t){this._networkId=t}get networkId(){return this._networkId}set accounts(t){this._accounts=t}get accounts(){return this._accounts}set rpcUrl(t){this._rpcUrl=t}get rpcUrl(){return this._rpcUrl}set connected(t){}get connected(){return this._connected}set pending(t){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(t){t&&(this._connected=t.connected,this.accounts=t.accounts,this.chainId=t.chainId,this.bridge=t.bridge,this.key=t.key,this.clientId=t.clientId,this.clientMeta=t.clientMeta,this.peerId=t.peerId,this.peerMeta=t.peerMeta,this.handshakeId=t.handshakeId,this.handshakeTopic=t.handshakeTopic)}on(t,e){const n={event:t,callback:e};this._eventManager.subscribe(n)}off(t){this._eventManager.unsubscribe(t)}async createInstantRequest(t){this._key=await this._generateKey();const e=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(t)}]});this.handshakeId=e.id,this.handshakeTopic=Object(s.uuid)(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error("User close QRCode Modal")});const n=()=>{this.killSession()};try{const t=await this._sendCallRequest(e);return t&&n(),t}catch(t){throw n(),t}}async connect(t){if(!this._qrcodeModal)throw new Error("QRCode Modal not provided");return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(t),new Promise(async(t,e)=>{this.on("modal_closed",()=>e(new Error("User close QRCode Modal"))),this.on("connect",(n,r)=>{if(n)return e(n);t(r.params[0])})}))}async createSession(t){if(this._connected)throw new Error("Session currently connected");if(this.pending)return;this._key=await this._generateKey();const e=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:t&&t.chainId?t.chainId:null}]});this.handshakeId=e.id,this.handshakeTopic=Object(s.uuid)(),this._sendSessionRequest(e,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(t){if(this._connected)throw new Error("Session currently connected");this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},n={id:this.handshakeId,jsonrpc:"2.0",result:e};this._sendResponse(n),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(t){if(this._connected)throw new Error("Session currently connected");const e=t&&t.message?t.message:"Session Rejected",n=this._formatResponse({id:this.handshakeId,error:{message:e}});this._sendResponse(n),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession()}updateSession(t){if(!this._connected)throw new Error("Session currently disconnected");this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},n=this._formatRequest({method:"wc_sessionUpdate",params:[e]});this._sendSessionRequest(n,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(t){const e=t?t.message:"Session Disconnected",n=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(n),this._handleSessionDisconnect(e)}async sendTransaction(t){if(!this._connected)throw new Error("Session currently disconnected");const e=Object(s.parseTransactionData)(t),n=this._formatRequest({method:"eth_sendTransaction",params:[e]});return await this._sendCallRequest(n)}async signTransaction(t){if(!this._connected)throw new Error("Session currently disconnected");const e=Object(s.parseTransactionData)(t),n=this._formatRequest({method:"eth_signTransaction",params:[e]});return await this._sendCallRequest(n)}async signMessage(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"eth_sign",params:t});return await this._sendCallRequest(e)}async signPersonalMessage(t){if(!this._connected)throw new Error("Session currently disconnected");t=Object(s.parsePersonalSign)(t);const e=this._formatRequest({method:"personal_sign",params:t});return await this._sendCallRequest(e)}async signTypedData(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"eth_signTypedData",params:t});return await this._sendCallRequest(e)}async updateChain(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"wallet_updateChain",params:[t]});return await this._sendCallRequest(e)}unsafeSend(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),new Promise((e,n)=>{this._subscribeToResponse(t.id,(t,r)=>{if(t)n(t);else{if(!r)throw new Error("Missing JSON RPC response");e(r)}})})}async sendCustomRequest(t,e){if(!this._connected)throw new Error("Session currently disconnected");switch(t.method){case"eth_accounts":return this.accounts;case"eth_chainId":return Object(s.convertNumberToHex)(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":t.params&&(t.params[0]=Object(s.parseTransactionData)(t.params[0]));break;case"personal_sign":t.params&&(t.params=Object(s.parsePersonalSign)(t.params))}const n=this._formatRequest(t);return await this._sendCallRequest(n,e)}approveRequest(t){if(!Object(s.isJsonRpcResponseSuccess)(t))throw new Error('JSON-RPC success response must include "result" field');{const e=this._formatResponse(t);this._sendResponse(e)}}rejectRequest(t){if(!Object(s.isJsonRpcResponseError)(t))throw new Error('JSON-RPC error response must include "error" field');{const e=this._formatResponse(t);this._sendResponse(e)}}transportClose(){this._transport.close()}async _sendRequest(t,e){const n=this._formatRequest(t),r=await this._encrypt(n),o=void 0!==(null==e?void 0:e.topic)?e.topic:this.peerId,i=JSON.stringify(r),a=void 0!==(null==e?void 0:e.forcePushNotification)?!e.forcePushNotification:Object(s.isSilentPayload)(n);this._transport.send(i,o,a)}async _sendResponse(t){const e=await this._encrypt(t),n=this.peerId,r=JSON.stringify(e);this._transport.send(r,n,!0)}async _sendSessionRequest(t,e,n){this._sendRequest(t,n),this._subscribeToSessionResponse(t.id,e)}_sendCallRequest(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),this._subscribeToCallResponse(t.id)}_formatRequest(t){if(void 0===t.method)throw new Error('JSON RPC request must have valid "method" value');return{id:void 0===t.id?Object(s.payloadId)():t.id,jsonrpc:"2.0",method:t.method,params:void 0===t.params?[]:t.params}}_formatResponse(t){if(void 0===t.id)throw new Error('JSON RPC request must have valid "id" value');const e={id:t.id,jsonrpc:"2.0"};if(Object(s.isJsonRpcResponseError)(t)){const n=Object(s.formatRpcError)(t.error);return Object.assign(Object.assign(Object.assign({},e),t),{error:n})}if(Object(s.isJsonRpcResponseSuccess)(t)){return Object.assign(Object.assign({},e),t)}throw new Error("JSON RPC response format is invalid")}_handleSessionDisconnect(t){const e=t||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),Object(s.removeLocal)(s.mobileLinkChoiceKey)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(t,e){e&&e.approved?(this._connected?(e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),e.peerId&&!this.peerId&&(this.peerId=e.peerId),e.peerMeta&&!this.peerMeta&&(this.peerMeta=e.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(t)}async _handleIncomingMessages(t){if(![this.clientId,this.handshakeTopic].includes(t.topic))return;let e;try{e=JSON.parse(t.payload)}catch(t){return}const n=await this._decrypt(e);n&&this._eventManager.trigger(n)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(t,e){this.on("response:"+t,e)}_subscribeToSessionResponse(t,e){this._subscribeToResponse(t,(t,n)=>{t?this._handleSessionResponse(t.message):Object(s.isJsonRpcResponseSuccess)(n)?this._handleSessionResponse(e,n.result):n.error&&n.error.message?this._handleSessionResponse(n.error.message):this._handleSessionResponse(e)})}_subscribeToCallResponse(t){return new Promise((e,n)=>{this._subscribeToResponse(t,(t,r)=>{t?n(t):Object(s.isJsonRpcResponseSuccess)(r)?e(r.result):r.error&&r.error.message?n(new Error(r.error.message)):n(new Error("JSON RPC response format is invalid"))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(t,e)=>{const{request:n}=e.params[0];if(Object(s.isMobile)()&&this._signingMethods.includes(n.method)){const t=Object(s.getLocal)(s.mobileLinkChoiceKey);t&&(window.location.href=t.href)}}),this.on("wc_sessionRequest",(t,e)=>{t&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:t.toString()}]}),this.handshakeId=e.id,this.peerId=e.params[0].peerId,this.peerMeta=e.params[0].peerMeta;const n=Object.assign(Object.assign({},e),{method:"session_request"});this._eventManager.trigger(n)}),this.on("wc_sessionUpdate",(t,e)=>{t&&this._handleSessionResponse(t.message),this._handleSessionResponse("Session disconnected",e.params[0])})}_initTransport(){this._transport.on("message",t=>this._handleIncomingMessages(t)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(t){const e=Object(s.parseWalletConnectUri)(t);if(e.protocol===this.protocol){if(!e.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const t=e.handshakeTopic;if(!e.bridge)throw Error("Invalid or missing bridge url parameter value");const n=decodeURIComponent(e.bridge);if(!e.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:t,bridge:n,key:e.key}}throw new Error("URI format is invalid")}async _generateKey(){if(this._cryptoLib){return await this._cryptoLib.generateKey()}return null}async _encrypt(t){const e=this._key;if(this._cryptoLib&&e){return await this._cryptoLib.encrypt(t,e)}return null}async _decrypt(t){const e=this._key;if(this._cryptoLib&&e){return await this._cryptoLib.decrypt(t,e)}return null}_getStorageSession(){let t=null;return this._sessionStorage&&(t=this._sessionStorage.getSession()),t}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(t){if(!t.url||"string"!=typeof t.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!t.type||"string"!=typeof t.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!t.token||"string"!=typeof t.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const e={bridge:this.bridge,topic:this.clientId,type:t.type,token:t.token,peerName:"",language:t.language||""};this.on("connect",async(n,r)=>{if(n)throw n;if(t.peerMeta){const t=r.params[0].peerMeta.name;e.peerName=t}try{const n=await fetch(t.url+"/new",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)});if(!(await n.json()).success)throw Error("Failed to register in Push Server")}catch(n){throw Error("Failed to register in Push Server")}})}},d=n(13),p=n(0);async function g(t){const e=(t||256)/8,n=d.randomBytes(e);return Object(s.convertBufferToArrayBuffer)(p.b(n))}async function m(t,e){const n=p.n(t.data),r=p.n(t.iv),o=p.n(t.hmac),i=p.c(o,!1),s=p.j(n,r),a=await d.hmacSha256Sign(e,s),u=p.c(a,!1);return p.x(i)===p.x(u)}async function v(t,e,n){const r=p.f(Object(s.convertArrayBufferToBuffer)(e)),o=n||await g(128),i=p.f(Object(s.convertArrayBufferToBuffer)(o)),a=p.c(i,!1),u=JSON.stringify(t),c=p.z(u),l=await d.aesCbcEncrypt(i,r,c),h=p.c(l,!1),f=p.j(l,i),m=await d.hmacSha256Sign(r,f);return{data:h,hmac:p.c(m,!1),iv:a}}async function _(t,e){const n=p.f(Object(s.convertArrayBufferToBuffer)(e));if(!n)throw new Error("Missing key: required for decryption");if(!await m(t,n))return null;const r=p.n(t.data),o=p.n(t.iv),i=await d.aesCbcDecrypt(o,n,r),a=p.e(i);let u;try{u=JSON.parse(a)}catch(t){return null}return u}var y=class extends f{constructor(t,e){super({cryptoLib:r,connectorOpts:t,pushServerOpts:e})}},w=n(56),b=n.n(w),M=n(19),E=n(5);n.d(e,"SignerConnection",(function(){return x}));class x extends M.IJsonRpcConnection{constructor(t){super(),this.events=new i.a,this.accounts=[],this.chainId=1,this.pending=!1,this.bridge="https://bridge.walletconnect.org",this.qrcode=!0,this.qrcodeModalOptions=void 0,this.opts=t,this.chainId=(null==t?void 0:t.chainId)||this.chainId,this.wc=this.register(t)}get connected(){return void 0!==this.wc&&this.wc.connected}get connecting(){return this.pending}get connector(){return this.wc=this.register(this.opts),this.wc}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t){if(!this.connected)return new Promise((e,n)=>{this.on("error",t=>{n(t)}),this.on("open",()=>{e()}),this.create(t)});this.onOpen()}async close(){void 0!==this.wc&&(this.wc.connected&&this.wc.killSession(),this.onClose())}async send(t){this.wc=this.register(this.opts),this.connected||await this.open(),this.sendPayload(t).then(t=>this.events.emit("payload",t)).catch(e=>this.events.emit("payload",Object(E.formatJsonRpcError)(t.id,e.message)))}register(t){if(this.wc)return this.wc;this.opts=t||this.opts,this.bridge=(null==t?void 0:t.connector)?t.connector.bridge:(null==t?void 0:t.bridge)||"https://bridge.walletconnect.org",this.qrcode=void 0===(null==t?void 0:t.qrcode)||!1!==t.qrcode,this.chainId=void 0!==(null==t?void 0:t.chainId)?t.chainId:this.chainId,this.qrcodeModalOptions=null==t?void 0:t.qrcodeModalOptions;const e={bridge:this.bridge,qrcodeModal:this.qrcode?b.a:void 0,qrcodeModalOptions:this.qrcodeModalOptions,storageId:null==t?void 0:t.storageId,signingMethods:null==t?void 0:t.signingMethods,clientMeta:null==t?void 0:t.clientMeta};if(this.wc=void 0!==(null==t?void 0:t.connector)?t.connector:new y(e),void 0===this.wc)throw new Error("Failed to register WalletConnect connector");return this.wc.accounts.length&&(this.accounts=this.wc.accounts),this.wc.chainId&&(this.chainId=this.wc.chainId),this.registerConnectorEvents(),this.wc}onOpen(t){this.pending=!1,t&&(this.wc=t),this.events.emit("open")}onClose(){this.pending=!1,this.wc&&(this.wc=void 0),this.events.emit("close")}onError(t,e="Failed or Rejected Request",n=-32e3){const r={id:t.id,jsonrpc:t.jsonrpc,error:{code:n,message:e}};return this.events.emit("payload",r),r}create(t){this.wc=this.register(this.opts),this.chainId=t||this.chainId,this.connected||this.pending||(this.pending=!0,this.registerConnectorEvents(),this.wc.createSession({chainId:this.chainId}).then(()=>this.events.emit("created")).catch(t=>this.events.emit("error",t)))}registerConnectorEvents(){this.wc=this.register(this.opts),this.wc.on("connect",t=>{var e,n;t?this.events.emit("error",t):(this.accounts=(null===(e=this.wc)||void 0===e?void 0:e.accounts)||[],this.chainId=(null===(n=this.wc)||void 0===n?void 0:n.chainId)||this.chainId,this.onOpen())}),this.wc.on("disconnect",t=>{t?this.events.emit("error",t):this.onClose()}),this.wc.on("modal_closed",()=>{this.events.emit("error",new Error("User closed modal"))}),this.wc.on("session_update",(t,e)=>{const{accounts:n,chainId:r}=e.params[0];(!this.accounts||n&&this.accounts!==n)&&(this.accounts=n,this.events.emit("accountsChanged",n)),(!this.chainId||r&&this.chainId!==r)&&(this.chainId=r,this.events.emit("chainChanged",r))})}async sendPayload(t){this.wc=this.register(this.opts);try{const e=await this.wc.unsafeSend(t);return this.sanitizeResponse(e)}catch(e){return this.onError(t,e.message)}}sanitizeResponse(t){return void 0!==t.error&&void 0===t.error.code?Object(E.formatJsonRpcError)(t.id,t.error.message):t}}e.default=x},function(t,e,n){"use strict";n.r(e);var r,o,i,s,a,u,c,l={},h=[],f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function d(t,e){for(var n in e)t[n]=e[n];return t}function p(t){var e=t.parentNode;e&&e.removeChild(t)}function g(t,e,n){var r,o=arguments,i={};for(r in e)"key"!==r&&"ref"!==r&&(i[r]=e[r]);if(arguments.length>3)for(n=[n],r=3;r<arguments.length;r++)n.push(o[r]);if(null!=n&&(i.children=n),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===i[r]&&(i[r]=t.defaultProps[r]);return m(t,i,e&&e.key,e&&e.ref,null)}function m(t,e,n,o,i){var s={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i};return null==i&&(s.__v=s),r.vnode&&r.vnode(s),s}function v(){return{}}function _(t){return t.children}function y(t,e){this.props=t,this.context=e}function w(t,e){if(null==e)return t.__?w(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?w(t):null}function b(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return b(t)}}function M(t){(!t.__d&&(t.__d=!0)&&o.push(t)&&!i++||a!==r.debounceRendering)&&((a=r.debounceRendering)||s)(E)}function E(){for(var t;i=o.length;)t=o.sort((function(t,e){return t.__v.__b-e.__v.__b})),o=[],t.some((function(t){var e,n,r,o,i,s,a;t.__d&&(s=(i=(e=t).__v).__e,(a=e.__P)&&(n=[],(r=d({},i)).__v=r,o=C(a,i,r,e.__n,void 0!==a.ownerSVGElement,null,n,null==s?w(i):s),O(n,i),o!=s&&b(i)))}))}function x(t,e,n,r,o,i,s,a,u){var c,f,d,g,m,v,_,y=n&&n.__k||h,b=y.length;if(a==l&&(a=null!=i?i[0]:b?w(n,0):null),c=0,e.__k=R(e.__k,(function(n){if(null!=n){if(n.__=e,n.__b=e.__b+1,null===(d=y[c])||d&&n.key==d.key&&n.type===d.type)y[c]=void 0;else for(f=0;f<b;f++){if((d=y[f])&&n.key==d.key&&n.type===d.type){y[f]=void 0;break}d=null}if(g=C(t,n,d=d||l,r,o,i,s,a,u),(f=n.ref)&&d.ref!=f&&(_||(_=[]),d.ref&&_.push(d.ref,null,n),_.push(f,n.__c||g,n)),null!=g){var h;if(null==v&&(v=g),void 0!==n.__d)h=n.__d,n.__d=void 0;else if(i==d||g!=a||null==g.parentNode){t:if(null==a||a.parentNode!==t)t.appendChild(g),h=null;else{for(m=a,f=0;(m=m.nextSibling)&&f<b;f+=2)if(m==g)break t;t.insertBefore(g,a),h=a}"option"==e.type&&(t.value="")}a=void 0!==h?h:g.nextSibling,"function"==typeof e.type&&(e.__d=a)}else a&&d.__e==a&&a.parentNode!=t&&(a=w(d))}return c++,n})),e.__e=v,null!=i&&"function"!=typeof e.type)for(c=i.length;c--;)null!=i[c]&&p(i[c]);for(c=b;c--;)null!=y[c]&&P(y[c],y[c]);if(_)for(c=0;c<_.length;c++)I(_[c],_[++c],_[++c])}function R(t,e,n){if(null==n&&(n=[]),null==t||"boolean"==typeof t)e&&n.push(e(null));else if(Array.isArray(t))for(var r=0;r<t.length;r++)R(t[r],e,n);else n.push(e?e("string"==typeof t||"number"==typeof t?m(null,t,null,null,t):null!=t.__e||null!=t.__c?m(t.type,t.props,t.key,null,t.__v):t):t);return n}function S(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]="number"==typeof n&&!1===f.test(e)?n+"px":null==n?"":n}function k(t,e,n,r,o){var i,s,a,u,c;if(o?"className"===e&&(e="class"):"class"===e&&(e="className"),"style"===e)if(i=t.style,"string"==typeof n)i.cssText=n;else{if("string"==typeof r&&(i.cssText="",r=null),r)for(u in r)n&&u in n||S(i,u,"");if(n)for(c in n)r&&n[c]===r[c]||S(i,c,n[c])}else"o"===e[0]&&"n"===e[1]?(s=e!==(e=e.replace(/Capture$/,"")),a=e.toLowerCase(),e=(a in t?a:e).slice(2),n?(r||t.addEventListener(e,A,s),(t.l||(t.l={}))[e]=n):t.removeEventListener(e,A,s)):"list"!==e&&"tagName"!==e&&"form"!==e&&"type"!==e&&"size"!==e&&!o&&e in t?t[e]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==e&&(e!==(e=e.replace(/^xlink:?/,""))?null==n||!1===n?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(e)?t.removeAttribute(e):t.setAttribute(e,n))}function A(t){this.l[t.type](r.event?r.event(t):t)}function C(t,e,n,o,i,s,a,u,c){var l,h,f,p,g,m,v,w,b,M,E=e.type;if(void 0!==e.constructor)return null;(l=r.__b)&&l(e);try{t:if("function"==typeof E){if(w=e.props,b=(l=E.contextType)&&o[l.__c],M=l?b?b.props.value:l.__:o,n.__c?v=(h=e.__c=n.__c).__=h.__E:("prototype"in E&&E.prototype.render?e.__c=h=new E(w,M):(e.__c=h=new y(w,M),h.constructor=E,h.render=B),b&&b.sub(h),h.props=w,h.state||(h.state={}),h.context=M,h.__n=o,f=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d({},h.__s)),d(h.__s,E.getDerivedStateFromProps(w,h.__s))),p=h.props,g=h.state,f)null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==E.getDerivedStateFromProps&&w!==p&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(w,M),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(w,h.__s,M)||e.__v===n.__v&&!h.__){for(h.props=w,h.state=h.__s,e.__v!==n.__v&&(h.__d=!1),h.__v=e,e.__e=n.__e,e.__k=n.__k,h.__h.length&&a.push(h),l=0;l<e.__k.length;l++)e.__k[l]&&(e.__k[l].__=e);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(w,h.__s,M),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(p,g,m)}))}h.context=M,h.props=w,h.state=h.__s,(l=r.__r)&&l(e),h.__d=!1,h.__v=e,h.__P=t,l=h.render(h.props,h.state,h.context),e.__k=null!=l&&l.type==_&&null==l.key?l.props.children:Array.isArray(l)?l:[l],null!=h.getChildContext&&(o=d(d({},o),h.getChildContext())),f||null==h.getSnapshotBeforeUpdate||(m=h.getSnapshotBeforeUpdate(p,g)),x(t,e,n,o,i,s,a,u,c),h.base=e.__e,h.__h.length&&a.push(h),v&&(h.__E=h.__=null),h.__e=!1}else null==s&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=T(n.__e,e,n,o,i,s,a,c);(l=r.diffed)&&l(e)}catch(t){e.__v=null,r.__e(t,e,n)}return e.__e}function O(t,e){r.__c&&r.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){r.__e(t,e.__v)}}))}function T(t,e,n,r,o,i,s,a){var u,c,f,d,p,g=n.props,m=e.props;if(o="svg"===e.type||o,null!=i)for(u=0;u<i.length;u++)if(null!=(c=i[u])&&((null===e.type?3===c.nodeType:c.localName===e.type)||t==c)){t=c,i[u]=null;break}if(null==t){if(null===e.type)return document.createTextNode(m);t=o?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type,m.is&&{is:m.is}),i=null,a=!1}if(null===e.type)g!==m&&t.data!=m&&(t.data=m);else{if(null!=i&&(i=h.slice.call(t.childNodes)),f=(g=n.props||l).dangerouslySetInnerHTML,d=m.dangerouslySetInnerHTML,!a){if(g===l)for(g={},p=0;p<t.attributes.length;p++)g[t.attributes[p].name]=t.attributes[p].value;(d||f)&&(d&&f&&d.__html==f.__html||(t.innerHTML=d&&d.__html||""))}(function(t,e,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in e||k(t,i,null,n[i],r);for(i in e)o&&"function"!=typeof e[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===e[i]||k(t,i,e[i],n[i],r)})(t,m,g,o,a),d?e.__k=[]:(e.__k=e.props.children,x(t,e,n,r,"foreignObject"!==e.type&&o,i,s,l,a)),a||("value"in m&&void 0!==(u=m.value)&&u!==t.value&&k(t,"value",u,g.value,!1),"checked"in m&&void 0!==(u=m.checked)&&u!==t.checked&&k(t,"checked",u,g.checked,!1))}return t}function I(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){r.__e(t,n)}}function P(t,e,n){var o,i,s;if(r.unmount&&r.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||I(o,null,e)),n||"function"==typeof t.type||(n=null!=(i=t.__e)),t.__e=t.__d=void 0,null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){r.__e(t,e)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&P(o[s],e,n);null!=i&&p(i)}function B(t,e,n){return this.constructor(t,n)}function L(t,e,n){var o,i,s;r.__&&r.__(t,e),i=(o=n===u)?null:n&&n.__k||e.__k,t=g(_,null,[t]),s=[],C(e,(o?e:n||e).__k=t,i||l,l,void 0!==e.ownerSVGElement,n&&!o?[n]:i?null:h.slice.call(e.childNodes),s,n||l,o),O(s,t)}function N(t,e){L(t,e,u)}function j(t,e){var n,r;for(r in e=d(d({},t.props),e),arguments.length>2&&(e.children=h.slice.call(arguments,2)),n={},e)"key"!==r&&"ref"!==r&&(n[r]=e[r]);return m(t.type,n,e.key||t.key,e.ref||t.ref,null)}function U(t){var e={},n={__c:"__cC"+c++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var r,o=this;return this.getChildContext||(r=[],this.getChildContext=function(){return e[n.__c]=o,e},this.shouldComponentUpdate=function(t){o.props.value!==t.value&&r.some((function(e){e.context=t.value,M(e)}))},this.sub=function(t){r.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){r.splice(r.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Consumer.contextType=n,n.Provider.__=n,n}r={__e:function(t,e){for(var n,r;e=e.__;)if((n=e.__c)&&!n.__)try{if(n.constructor&&null!=n.constructor.getDerivedStateFromError&&(r=!0,n.setState(n.constructor.getDerivedStateFromError(t))),null!=n.componentDidCatch&&(r=!0,n.componentDidCatch(t)),r)return M(n.__E=n)}catch(e){t=e}throw t}},y.prototype.setState=function(t,e){var n;n=this.__s!==this.state?this.__s:this.__s=d({},this.state),"function"==typeof t&&(t=t(n,this.props)),t&&d(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),M(this))},y.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),M(this))},y.prototype.render=_,o=[],i=0,s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=l,c=0;var q,D,J,F=0,H=[],W=r.__r,z=r.diffed,Y=r.__c,$=r.unmount;function V(t,e){r.__h&&r.__h(D,t,F||e),F=0;var n=D.__H||(D.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function K(t){return F=1,Q(lt,t)}function Q(t,e,n){var r=V(q++,2);return r.__c||(r.__c=D,r.__=[n?n(e):lt(void 0,e),function(e){var n=t(r.__[0],e);r.__[0]!==n&&(r.__[0]=n,r.__c.setState({}))}]),r.__}function Z(t,e){var n=V(q++,3);!r.__s&&ct(n.__H,e)&&(n.__=t,n.__H=e,D.__H.__h.push(n))}function X(t,e){var n=V(q++,4);!r.__s&&ct(n.__H,e)&&(n.__=t,n.__H=e,D.__h.push(n))}function G(t){return F=5,et((function(){return{current:t}}),[])}function tt(t,e,n){F=6,X((function(){"function"==typeof t?t(e()):t&&(t.current=e())}),null==n?n:n.concat(t))}function et(t,e){var n=V(q++,7);return ct(n.__H,e)?(n.__H=e,n.__h=t,n.__=t()):n.__}function nt(t,e){return F=8,et((function(){return t}),e)}function rt(t){var e=D.context[t.__c],n=V(q++,9);return n.__c=t,e?(null==n.__&&(n.__=!0,e.sub(D)),e.props.value):t.__}function ot(t,e){r.useDebugValue&&r.useDebugValue(e?e(t):t)}function it(t){var e=V(q++,10),n=K();return e.__=t,D.componentDidCatch||(D.componentDidCatch=function(t){e.__&&e.__(t),n[1](t)}),[n[0],function(){n[1](void 0)}]}function st(){H.some((function(t){if(t.__P)try{t.__H.__h.forEach(at),t.__H.__h.forEach(ut),t.__H.__h=[]}catch(e){return t.__H.__h=[],r.__e(e,t.__v),!0}})),H=[]}function at(t){t.t&&t.t()}function ut(t){var e=t.__();"function"==typeof e&&(t.t=e)}function ct(t,e){return!t||e.some((function(e,n){return e!==t[n]}))}function lt(t,e){return"function"==typeof e?e(t):e}function ht(t,e){for(var n in e)t[n]=e[n];return t}function ft(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var r in e)if("__source"!==r&&t[r]!==e[r])return!0;return!1}r.__r=function(t){W&&W(t),q=0,(D=t.__c).__H&&(D.__H.__h.forEach(at),D.__H.__h.forEach(ut),D.__H.__h=[])},r.diffed=function(t){z&&z(t);var e=t.__c;if(e){var n=e.__H;n&&n.__h.length&&(1!==H.push(e)&&J===r.requestAnimationFrame||((J=r.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(r),cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);"undefined"!=typeof window&&(e=requestAnimationFrame(n))})(st))}},r.__c=function(t,e){e.some((function(t){try{t.__h.forEach(at),t.__h=t.__h.filter((function(t){return!t.__||ut(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],r.__e(n,t.__v)}})),Y&&Y(t,e)},r.unmount=function(t){$&&$(t);var e=t.__c;if(e){var n=e.__H;if(n)try{n.__.forEach((function(t){return t.t&&t.t()}))}catch(t){r.__e(t,e.__v)}}},n.d(e,"version",(function(){return jt})),n.d(e,"Children",(function(){return _t})),n.d(e,"render",(function(){return Tt})),n.d(e,"hydrate",(function(){return It})),n.d(e,"unmountComponentAtNode",(function(){return Jt})),n.d(e,"createPortal",(function(){return At})),n.d(e,"createFactory",(function(){return Ut})),n.d(e,"cloneElement",(function(){return Dt})),n.d(e,"isValidElement",(function(){return qt})),n.d(e,"findDOMNode",(function(){return Ft})),n.d(e,"PureComponent",(function(){return dt})),n.d(e,"memo",(function(){return pt})),n.d(e,"forwardRef",(function(){return mt})),n.d(e,"unstable_batchedUpdates",(function(){return Ht})),n.d(e,"Suspense",(function(){return bt})),n.d(e,"SuspenseList",(function(){return xt})),n.d(e,"lazy",(function(){return Et})),n.d(e,"useState",(function(){return K})),n.d(e,"useReducer",(function(){return Q})),n.d(e,"useEffect",(function(){return Z})),n.d(e,"useLayoutEffect",(function(){return X})),n.d(e,"useRef",(function(){return G})),n.d(e,"useImperativeHandle",(function(){return tt})),n.d(e,"useMemo",(function(){return et})),n.d(e,"useCallback",(function(){return nt})),n.d(e,"useContext",(function(){return rt})),n.d(e,"useDebugValue",(function(){return ot})),n.d(e,"useErrorBoundary",(function(){return it})),n.d(e,"createElement",(function(){return g})),n.d(e,"createContext",(function(){return U})),n.d(e,"createRef",(function(){return v})),n.d(e,"Fragment",(function(){return _})),n.d(e,"Component",(function(){return y}));var dt=function(t){var e,n;function r(e){var n;return(n=t.call(this,e)||this).isPureReactComponent=!0,n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r.prototype.shouldComponentUpdate=function(t,e){return ft(this.props,t)||ft(this.state,e)},r}(y);function pt(t,e){function n(t){var n=this.props.ref,r=n==t.ref;return!r&&n&&(n.call?n(null):n.current=null),e?!e(this.props,t)||!r:ft(this.props,t)}function r(e){return this.shouldComponentUpdate=n,g(t,ht({},e))}return r.prototype.isReactComponent=!0,r.displayName="Memo("+(t.displayName||t.name)+")",r.t=!0,r}var gt=r.__b;function mt(t){function e(e){var n=ht({},e);return delete n.ref,t(n,e.ref)}return e.prototype.isReactComponent=e.t=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}r.__b=function(t){t.type&&t.type.t&&t.ref&&(t.props.ref=t.ref,t.ref=null),gt&>(t)};var vt=function(t,e){return t?R(t).reduce((function(t,n,r){return t.concat(e(n,r))}),[]):null},_t={map:vt,forEach:vt,count:function(t){return t?R(t).length:0},only:function(t){if(1!==(t=R(t)).length)throw new Error("Children.only() expects only one child.");return t[0]},toArray:R},yt=r.__e;function wt(t){return t&&((t=ht({},t)).__c=null,t.__k=t.__k&&t.__k.map(wt)),t}function bt(){this.__u=0,this.o=null,this.__b=null}function Mt(t){var e=t.__.__c;return e&&e.u&&e.u(t)}function Et(t){var e,n,r;function o(o){if(e||(e=t()).then((function(t){n=t.default||t}),(function(t){r=t})),r)throw r;if(!n)throw e;return g(n,o)}return o.displayName="Lazy",o.t=!0,o}function xt(){this.i=null,this.l=null}r.__e=function(t,e,n){if(t.then)for(var r,o=e;o=o.__;)if((r=o.__c)&&r.__c)return r.__c(t,e.__c);yt(t,e,n)},(bt.prototype=new y).__c=function(t,e){var n=this;null==n.o&&(n.o=[]),n.o.push(e);var r=Mt(n.__v),o=!1,i=function(){o||(o=!0,r?r(s):s())};e.__c=e.componentWillUnmount,e.componentWillUnmount=function(){i(),e.__c&&e.__c()};var s=function(){var t;if(!--n.__u)for(n.__v.__k[0]=n.state.u,n.setState({u:n.__b=null});t=n.o.pop();)t.forceUpdate()};n.__u++||n.setState({u:n.__b=n.__v.__k[0]}),t.then(i,i)},bt.prototype.render=function(t,e){return this.__b&&(this.__v.__k[0]=wt(this.__b),this.__b=null),[g(y,null,e.u?null:t.children),e.u&&t.fallback]};var Rt=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};(xt.prototype=new y).u=function(t){var e=this,n=Mt(e.__v),r=e.l.get(t);return r[0]++,function(o){var i=function(){e.props.revealOrder?(r.push(o),Rt(e,t,r)):o()};n?n(i):i()}},xt.prototype.render=function(t){this.i=null,this.l=new Map;var e=R(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},xt.prototype.componentDidUpdate=xt.prototype.componentDidMount=function(){var t=this;t.l.forEach((function(e,n){Rt(t,n,e)}))};var St=function(){function t(){}var e=t.prototype;return e.getChildContext=function(){return this.props.context},e.render=function(t){return t.children},t}();function kt(t){var e=this,n=t.container,r=g(St,{context:e.context},t.vnode);return e.s&&e.s!==n&&(e.v.parentNode&&e.s.removeChild(e.v),P(e.h),e.p=!1),t.vnode?e.p?(n.__k=e.__k,L(r,n),e.__k=n.__k):(e.v=document.createTextNode(""),N("",n),n.appendChild(e.v),e.p=!0,e.s=n,L(r,n,e.v),e.__k=e.v.__k):e.p&&(e.v.parentNode&&e.s.removeChild(e.v),P(e.h)),e.h=r,e.componentWillUnmount=function(){e.v.parentNode&&e.s.removeChild(e.v),P(e.h)},null}function At(t,e){return g(kt,{vnode:t,container:e})}var Ct=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;y.prototype.isReactComponent={};var Ot="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function Tt(t,e,n){if(null==e.__k)for(;e.firstChild;)e.removeChild(e.firstChild);return L(t,e),"function"==typeof n&&n(),t?t.__c:null}function It(t,e,n){return N(t,e),"function"==typeof n&&n(),t?t.__c:null}var Pt=r.event;function Bt(t,e){t["UNSAFE_"+e]&&!t[e]&&Object.defineProperty(t,e,{configurable:!1,get:function(){return this["UNSAFE_"+e]},set:function(t){this["UNSAFE_"+e]=t}})}r.event=function(t){Pt&&(t=Pt(t)),t.persist=function(){};var e=!1,n=!1,r=t.stopPropagation;t.stopPropagation=function(){r.call(t),e=!0};var o=t.preventDefault;return t.preventDefault=function(){o.call(t),n=!0},t.isPropagationStopped=function(){return e},t.isDefaultPrevented=function(){return n},t.nativeEvent=t};var Lt={configurable:!0,get:function(){return this.class}},Nt=r.vnode;r.vnode=function(t){t.$$typeof=Ot;var e=t.type,n=t.props;if(e){if(n.class!=n.className&&(Lt.enumerable="className"in n,null!=n.className&&(n.class=n.className),Object.defineProperty(n,"className",Lt)),"function"!=typeof e){var r,o,i;for(i in n.defaultValue&&void 0!==n.value&&(n.value||0===n.value||(n.value=n.defaultValue),delete n.defaultValue),Array.isArray(n.value)&&n.multiple&&"select"===e&&(R(n.children).forEach((function(t){-1!=n.value.indexOf(t.props.value)&&(t.props.selected=!0)})),delete n.value),n)if(r=Ct.test(i))break;if(r)for(i in o=t.props={},n)o[Ct.test(i)?i.replace(/[A-Z0-9]/,"-$&").toLowerCase():i]=n[i]}!function(e){var n=t.type,r=t.props;if(r&&"string"==typeof n){var o={};for(var i in r)/^on(Ani|Tra|Tou)/.test(i)&&(r[i.toLowerCase()]=r[i],delete r[i]),o[i.toLowerCase()]=i;if(o.ondoubleclick&&(r.ondblclick=r[o.ondoubleclick],delete r[o.ondoubleclick]),o.onbeforeinput&&(r.onbeforeinput=r[o.onbeforeinput],delete r[o.onbeforeinput]),o.onchange&&("textarea"===n||"input"===n.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var s=o.oninput||"oninput";r[s]||(r[s]=r[o.onchange],delete r[o.onchange])}}}(),"function"==typeof e&&!e.m&&e.prototype&&(Bt(e.prototype,"componentWillMount"),Bt(e.prototype,"componentWillReceiveProps"),Bt(e.prototype,"componentWillUpdate"),e.m=!0)}Nt&&Nt(t)};var jt="16.8.0";function Ut(t){return g.bind(null,t)}function qt(t){return!!t&&t.$$typeof===Ot}function Dt(t){return qt(t)?j.apply(null,arguments):t}function Jt(t){return!!t.__k&&(L(null,t),!0)}function Ft(t){return t&&(t.base||1===t.nodeType&&t)||null}var Ht=function(t,e){return t(e)};e.default={useState:K,useReducer:Q,useEffect:Z,useLayoutEffect:X,useRef:G,useImperativeHandle:tt,useMemo:et,useCallback:nt,useContext:rt,useDebugValue:ot,version:"16.8.0",Children:_t,render:Tt,hydrate:Tt,unmountComponentAtNode:Jt,createPortal:At,createElement:g,createContext:U,createFactory:Ut,cloneElement:Dt,createRef:v,Fragment:_,isValidElement:qt,findDOMNode:Ft,Component:y,PureComponent:dt,memo:pt,forwardRef:mt,unstable_batchedUpdates:Ht,Suspense:bt,SuspenseList:xt,lazy:Et}},function(t,e,n){"use strict";n.r(e);var r=n(20),o=n(5);class i extends o.IJsonRpcProvider{constructor(t){super(t),this.events=new r.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async request(t,e){return this.requestStrict(Object(o.formatJsonRpcRequest)(t.method,t.params||[]),e)}async requestStrict(t,e){return new Promise(async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(t){r(t)}this.events.on(""+t.id,t=>{Object(o.isJsonRpcError)(t)?r(t.error.message):n(t.result)});try{await this.connection.send(t,e)}catch(t){r(t)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Object(o.isJsonRpcResponse)(t)?this.events.emit(""+t.id,t):this.events.emit("message",{type:t.method,data:t.params})}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof t&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",()=>this.events.emit("disconnect")),this.connection.on("error",t=>this.events.emit("error",t)),this.hasRegisteredEventListeners=!0)}}var s=i;n.d(e,"JsonRpcProvider",(function(){return i}));e.default=s},function(t,e,n){"use strict";n.r(e);var r=n(20),o=n(27),i=n.n(o),s=n(11),a=n(5);const u={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class c{constructor(t){if(this.url=t,this.events=new r.EventEmitter,this.isAvailable=!1,this.registering=!1,!Object(a.isHttpUrl)(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);this.url=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t,e){this.isAvailable||await this.register();try{const e=Object(s.b)(t),n=await i()(this.url,Object.assign(Object.assign({},u),{body:e})),r=await n.json();this.onPayload({data:r})}catch(e){this.onError(t.id,e)}}async register(t=this.url){if(!Object(a.isHttpUrl)(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);if(this.registering)return new Promise((t,e)=>{this.events.once("register_error",t=>{e(t)}),this.events.once("open",()=>{if(void 0===this.isAvailable)return e(new Error("HTTP connection is missing or invalid"));t()})});this.url=t,this.registering=!0;try{const e=Object(s.b)({id:1,jsonrpc:"2.0",method:"test",params:[]});await i()(t,Object.assign(Object.assign({},u),{body:e})),this.onOpen()}catch(t){const e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(void 0===t.data)return;const e="string"==typeof t.data?Object(s.a)(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const n=this.parseError(e),r=n.message||n.toString(),o=Object(a.formatJsonRpcError)(t,r);this.events.emit("payload",o)}parseError(t,e=this.url){return Object(a.parseConnectionError)(t,e,"HTTP")}}var l=c;n.d(e,"HttpConnection",(function(){return c}));e.default=l}])}));
|